代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dhcp 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 569ca7918daa63832207e0d96f7d0b2d78300850 Mon Sep 17 00:00:00 2001
From: zhanglu <zhanglu37@huawei.com>
Date: Thu, 27 Feb 2020 20:47:22 +0800
Subject: [PATCH] dhcp: solve start dhclient when last pid was held.
Signed-off-by: zhanglu <zhanglu37@huawei.com>
---
client/dhclient.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/client/dhclient.c b/client/dhclient.c
index 9f8ba06..eff3444 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -774,15 +774,26 @@ main(int argc, char **argv) {
}
} else {
FILE *pidfp = NULL;
+ FILE *commfp = NULL;
long temp = 0;
pid_t dhcpid = 0;
int dhc_running = 0;
char procfn[256] = "";
+ char pidname_path[256] = "";
+ char pidname[256] = "";
if ((pidfp = fopen(path_dhclient_pid, "re")) != NULL) {
if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) {
snprintf(procfn,256,"/proc/%u",dhcpid);
- dhc_running = (access(procfn, F_OK) == 0);
+ snprintf(pidname_path,256,"%s/comm",procfn);
+
+ if (access(procfn, F_OK) == 0) {
+ if ((commfp = fopen(pidname_path, "r")) != NULL) {
+ fscanf(commfp, "%s", pidname);
+ dhc_running = (strncmp("dhclient", pidname, strlen("dhclient")) == 0);
+ fclose(commfp);
+ }
+ }
}
fclose(pidfp);
--
2.19.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。