diff options
author | Martin Blapp <mbr@FreeBSD.org> | 2003-09-02 09:09:53 +0000 |
---|---|---|
committer | Martin Blapp <mbr@FreeBSD.org> | 2003-09-02 09:09:53 +0000 |
commit | a26181dca1c54ade6db453aff1c82fd5a396152c (patch) | |
tree | f16559d52bdbcadea1b2f49f8e5df19eb6e7cc9d /contrib/isc-dhcp | |
parent | 1b4404f9abc712bf712a165664c9aab004d06536 (diff) | |
download | src-a26181dca1c54ade6db453aff1c82fd5a396152c.tar.gz src-a26181dca1c54ade6db453aff1c82fd5a396152c.zip |
Sync with ISC repo. Use SIGTERM instead of SIGKILL, make oldpid a long and
cast it into a pid_t.
Notes
Notes:
svn path=/head/; revision=119666
Diffstat (limited to 'contrib/isc-dhcp')
-rw-r--r-- | contrib/isc-dhcp/client/dhclient.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/contrib/isc-dhcp/client/dhclient.c b/contrib/isc-dhcp/client/dhclient.c index 90f8338825b5..e3f595249311 100644 --- a/contrib/isc-dhcp/client/dhclient.c +++ b/contrib/isc-dhcp/client/dhclient.c @@ -105,7 +105,7 @@ int main (argc, argv, envp) int argc; char **argv, **envp; { - int i, e; + int i; struct servent *ent; struct interface_info *ip; struct client_state *client; @@ -122,11 +122,8 @@ int main (argc, argv, envp) int no_dhclient_db = 0; int no_dhclient_pid = 0; int no_dhclient_script = 0; - FILE *pidfd; - pid_t oldpid; char *s; - oldpid = 0; /* Make sure we have stdin, stdout and stderr. */ i = open ("/dev/null", O_RDWR); if (i == 0) @@ -293,17 +290,23 @@ int main (argc, argv, envp) /* first kill of any currently running client */ if (release_mode) { + FILE *pidfd; + pid_t oldpid; + long temp; + int e; - if ((pidfd = fopen (path_dhclient_pid, "r")) != NULL) { - e = fscanf (pidfd, "%d", &oldpid); + oldpid = 0; + if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) { + e = fscanf(pidfd, "%ld\n", &temp); + oldpid = (pid_t)temp; if (e != 0 && e != EOF) { if (oldpid) { - if (kill (oldpid, SIGKILL) == 0) - unlink (path_dhclient_pid); + if (kill(oldpid, SIGTERM) == 0) + unlink(path_dhclient_pid); } } - fclose (pidfd); + fclose(pidfd); } } |