diff options
author | mbr <mbr@FreeBSD.org> | 2003-09-02 09:09:53 +0000 |
---|---|---|
committer | mbr <mbr@FreeBSD.org> | 2003-09-02 09:09:53 +0000 |
commit | 089f3c60d4f25befc0538372e474dd987f4dfebc (patch) | |
tree | f16559d52bdbcadea1b2f49f8e5df19eb6e7cc9d /contrib | |
parent | 512a5c372c607660618ae1fe7dd23c616573ad3f (diff) | |
download | FreeBSD-src-089f3c60d4f25befc0538372e474dd987f4dfebc.zip FreeBSD-src-089f3c60d4f25befc0538372e474dd987f4dfebc.tar.gz |
Sync with ISC repo. Use SIGTERM instead of SIGKILL, make oldpid a long and
cast it into a pid_t.
Diffstat (limited to 'contrib')
-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 90f8338..e3f5952 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); } } |