summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authormbr <mbr@FreeBSD.org>2003-09-02 09:09:53 +0000
committermbr <mbr@FreeBSD.org>2003-09-02 09:09:53 +0000
commit089f3c60d4f25befc0538372e474dd987f4dfebc (patch)
treef16559d52bdbcadea1b2f49f8e5df19eb6e7cc9d /contrib
parent512a5c372c607660618ae1fe7dd23c616573ad3f (diff)
downloadFreeBSD-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.c21
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);
}
}
OpenPOWER on IntegriCloud