From: Shawn Routhier Date: Tue, 27 Aug 2013 17:31:27 +0000 (-0700) Subject: [master] X-Git-Tag: v4_3_0a1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad4001ce8076c9e69aa0b7825cf9107c8bd9a101;p=thirdparty%2Fdhcp.git [master] Add a sleep call after trying to kill a previous client. This should make the "-r" option to the client work more consistently. [ISC-Bugs: 18175] --- diff --git a/RELNOTES b/RELNOTES index 86a1cb4d6..5cc71506d 100644 --- a/RELNOTES +++ b/RELNOTES @@ -92,6 +92,11 @@ work on other platforms. Please report any problems and suggested fixes to objects. [ISC-Bugs #27452] +- Added a sleep call after killing the old client to allow time + for the sockets to be cleaned. This should allow the -r option + to work more consistently. + [ISC-Bugs #18175] + Changes since 4.2.4 - Correct code to calculate timing values in client to compare diff --git a/client/dhclient.c b/client/dhclient.c index cfcf10cd5..aac808449 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -404,8 +404,16 @@ main(int argc, char **argv) { oldpid = (pid_t)temp; if (e != 0 && e != EOF) { - if (oldpid) - kill(oldpid, SIGTERM); + if (oldpid && (kill(oldpid, SIGTERM) == 0)) { + /* + * wait for the old process to + * cleanly terminate. + * Note kill() with sig=0 could + * detect termination but only + * the parent can be signaled... + */ + sleep(1); + } } fclose(pidfd); }