diff options
author | Russ Dill <Russ.Dill@asu.edu> | 2003-12-26 23:41:28 +0000 |
---|---|---|
committer | Russ Dill <Russ.Dill@asu.edu> | 2003-12-26 23:41:28 +0000 |
commit | 6caa073760f18c77237e717f8807d73b4126a8f4 (patch) | |
tree | 285b395fbbf65ec51b9817e6614b8c3f45cd9d34 | |
parent | ce91c8ac2bb343f0b3303c608c5a8b5a2252204d (diff) | |
download | busybox-6caa073760f18c77237e717f8807d73b4126a8f4.tar.gz |
it should work even if you don't assign a pidfile
-rw-r--r-- | networking/udhcp/common.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c index bfdc7ba8d..8542c664c 100644 --- a/networking/udhcp/common.c +++ b/networking/udhcp/common.c @@ -59,15 +59,14 @@ void background(const char *pidfile) #else /* __uClinux__ */ int pid_fd; - if (!pidfile) return; - - pid_fd = pidfile_acquire(pidfile); /* hold lock during fork. */ + /* hold lock during fork. */ + if (pidfile) pid_fd = pidfile_acquire(pidfile); if (daemon(0, 0) == -1) { perror("fork"); exit(1); } daemonized++; - pidfile_write_release(pid_fd); + if (pidfile) pidfile_write_release(pid_fd); #endif /* __uClinux__ */ } @@ -97,8 +96,10 @@ void start_log_and_pid(const char *client_server, const char *pidfile) sanitize_fds(); /* do some other misc startup stuff while we are here to save bytes */ - pid_fd = pidfile_acquire(pidfile); - pidfile_write_release(pid_fd); + if (pidfile) { + pid_fd = pidfile_acquire(pidfile); + pidfile_write_release(pid_fd); + } /* equivelent of doing a fflush after every \n */ setlinebuf(stdout); |