diff options
| author | russ <russ@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-26 23:41:28 +0000 |
|---|---|---|
| committer | russ <russ@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-26 23:41:28 +0000 |
| commit | efff3a810d2b13a71434ecf7d07154a70d0fc9bf (patch) | |
| tree | 285b395fbbf65ec51b9817e6614b8c3f45cd9d34 | |
| parent | 3624a9a2c2d7f935ad235a2cebc36fcabfa0a9b0 (diff) | |
| download | busybox-w32-efff3a810d2b13a71434ecf7d07154a70d0fc9bf.tar.gz busybox-w32-efff3a810d2b13a71434ecf7d07154a70d0fc9bf.tar.bz2 busybox-w32-efff3a810d2b13a71434ecf7d07154a70d0fc9bf.zip | |
it should work even if you don't assign a pidfile
git-svn-id: svn://busybox.net/trunk/busybox@8183 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -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) | |||
| 59 | #else /* __uClinux__ */ | 59 | #else /* __uClinux__ */ |
| 60 | int pid_fd; | 60 | int pid_fd; |
| 61 | 61 | ||
| 62 | if (!pidfile) return; | 62 | /* hold lock during fork. */ |
| 63 | 63 | if (pidfile) pid_fd = pidfile_acquire(pidfile); | |
| 64 | pid_fd = pidfile_acquire(pidfile); /* hold lock during fork. */ | ||
| 65 | if (daemon(0, 0) == -1) { | 64 | if (daemon(0, 0) == -1) { |
| 66 | perror("fork"); | 65 | perror("fork"); |
| 67 | exit(1); | 66 | exit(1); |
| 68 | } | 67 | } |
| 69 | daemonized++; | 68 | daemonized++; |
| 70 | pidfile_write_release(pid_fd); | 69 | if (pidfile) pidfile_write_release(pid_fd); |
| 71 | #endif /* __uClinux__ */ | 70 | #endif /* __uClinux__ */ |
| 72 | } | 71 | } |
| 73 | 72 | ||
| @@ -97,8 +96,10 @@ void start_log_and_pid(const char *client_server, const char *pidfile) | |||
| 97 | sanitize_fds(); | 96 | sanitize_fds(); |
| 98 | 97 | ||
| 99 | /* do some other misc startup stuff while we are here to save bytes */ | 98 | /* do some other misc startup stuff while we are here to save bytes */ |
| 100 | pid_fd = pidfile_acquire(pidfile); | 99 | if (pidfile) { |
| 101 | pidfile_write_release(pid_fd); | 100 | pid_fd = pidfile_acquire(pidfile); |
| 101 | pidfile_write_release(pid_fd); | ||
| 102 | } | ||
| 102 | 103 | ||
| 103 | /* equivelent of doing a fflush after every \n */ | 104 | /* equivelent of doing a fflush after every \n */ |
| 104 | setlinebuf(stdout); | 105 | setlinebuf(stdout); |
