diff --git a/bugfix-dhclient-check-if-pid-was-held.patch b/bugfix-dhclient-check-if-pid-was-held.patch new file mode 100644 index 0000000000000000000000000000000000000000..dd53f0b6b5d547089779c5746eeaddfa9177e2fe --- /dev/null +++ b/bugfix-dhclient-check-if-pid-was-held.patch @@ -0,0 +1,45 @@ +From bab9f6ff2345fb5a1db048349fe088c1ee7d440b Mon Sep 17 00:00:00 2001 +From: Anonymous_Z +Date: Tue, 3 Mar 2020 17:36:41 +0800 +Subject: [PATCH] dhcp: recheck whether last pid was held by other process + +Signed-off-by: zhanglu +--- + client/dhclient.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/client/dhclient.c b/client/dhclient.c +index 9f8ba06..97b04e0 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); +-- +1.8.3.1 + diff --git a/dhcp.spec b/dhcp.spec index 2cb4044fb6778b4756ef730edf0ee596663e9a7b..da74c252a26578199cf5d7e745695ea286624b76 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -3,7 +3,7 @@ Name: dhcp Version: 4.3.6 -Release: 34 +Release: 36 Summary: Dynamic host configuration protocol software #Please don't change the epoch on this package Epoch: 12 @@ -68,6 +68,7 @@ Patch6004: bugfix-reduce-getifaddr-calls.patch Patch9000: dhcp-fix-dhclient-default-len-64-to-128.patch Patch9001: bugfix-dhcpd-2038-problem.patch Patch9002: adds-address-prefix-len-to-dhclient-cli.patch +Patch9003: bugfix-dhclient-check-if-pid-was-held.patch BuildRequires: gcc autoconf automake libtool openldap-devel krb5-devel libcap-ng-devel bind-export-devel BuildRequires: systemd systemd-devel @@ -203,6 +204,7 @@ install -D -p -m 0644 contrib/ldap/dhcp.schema $RPM_BUILD_ROOT%{_sysconfdir}/ope find $RPM_BUILD_ROOT -type f -name "*.la" -delete -print %check +make check %pre %global gid_uid 177 @@ -304,6 +306,18 @@ exit 0 %{_mandir}/man3/omapi.3.gz %changelog +* Tue Mar 3 2020 openEuler Buildteam - 4.3.6-36 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:recheck if last pid was held by other process + +* Fri Feb 21 2020 openEuler Buildteam - 4.3.6-35 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: add make check + * Sat Jan 11 2020 openEuler Buildteam - 4.3.6-34 - Type:enhancement - ID:NA