1 Star 0 Fork 24

Air9/dhcp

forked from src-openEuler/dhcp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0021-Load-leases-DB-in-non-replay-mode-only.patch 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
eaglegai 提交于 2020-07-22 11:38 . update dhcp version to 4.4.2
commit 50c2b3ba8ce030a47b55dd707bb8a6ab20444a05
Author: Pavel Zhukov <pzhukov@redhat.com>
Date: Thu Feb 21 10:44:06 2019 +0100
Load leases DB in non-replay mode only
diff --git a/server/confpars.c b/server/confpars.c
index 2743979..6b61964 100644
--- a/server/confpars.c
+++ b/server/confpars.c
@@ -134,6 +134,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
cfile = (struct parse *)0;
#if defined (TRACING)
+ // No need to dmalloc huge memory region if we're not going to re-play
+ if (!trace_record()){
+ status = new_parse(&cfile, file, NULL, 0, filename, 0);
+ goto noreplay;
+ };
flen = lseek (file, (off_t)0, SEEK_END);
if (flen < 0) {
boom:
@@ -165,7 +170,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
if (result != ulen)
log_fatal ("%s: short read of %d bytes instead of %d.",
filename, ulen, result);
- close (file);
memfile:
/* If we're recording, write out the filename and file contents. */
if (trace_record ())
@@ -174,6 +178,9 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
#else
status = new_parse(&cfile, file, NULL, 0, filename, 0);
#endif
+ noreplay:
+ if (!trace_playback())
+ close (file);
if (status != ISC_R_SUCCESS || cfile == NULL)
return status;
@@ -183,7 +190,8 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
status = conf_file_subparse (cfile, group, group_type);
end_parse (&cfile);
#if defined (TRACING)
- dfree (dbuf, MDL);
+ if (trace_record())
+ dfree (dbuf, MDL);
#endif
return status;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/air9/dhcp.git
git@gitee.com:air9/dhcp.git
air9
dhcp
dhcp
master

搜索帮助