diff options
-rw-r--r-- | networking/udhcp/common.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c index ddfc54732..4f856ee6c 100644 --- a/networking/udhcp/common.c +++ b/networking/udhcp/common.c | |||
@@ -60,13 +60,13 @@ void background(const char *pidfile) | |||
60 | int pid_fd; | 60 | int pid_fd; |
61 | 61 | ||
62 | /* hold lock during fork. */ | 62 | /* hold lock during fork. */ |
63 | if (pidfile) pid_fd = pidfile_acquire(pidfile); | 63 | pid_fd = pidfile_acquire(pidfile); |
64 | if (daemon(0, 0) == -1) { | 64 | if (daemon(0, 0) == -1) { |
65 | perror("fork"); | 65 | perror("fork"); |
66 | exit(1); | 66 | exit(1); |
67 | } | 67 | } |
68 | daemonized++; | 68 | daemonized++; |
69 | if (pidfile) pidfile_write_release(pid_fd); | 69 | pidfile_write_release(pid_fd); |
70 | #endif /* __uClinux__ */ | 70 | #endif /* __uClinux__ */ |
71 | } | 71 | } |
72 | 72 | ||
@@ -96,10 +96,8 @@ void start_log_and_pid(const char *client_server, const char *pidfile) | |||
96 | sanitize_fds(); | 96 | sanitize_fds(); |
97 | 97 | ||
98 | /* 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 */ |
99 | if (pidfile) { | 99 | pid_fd = pidfile_acquire(pidfile); |
100 | pid_fd = pidfile_acquire(pidfile); | 100 | pidfile_write_release(pid_fd); |
101 | pidfile_write_release(pid_fd); | ||
102 | } | ||
103 | 101 | ||
104 | /* equivelent of doing a fflush after every \n */ | 102 | /* equivelent of doing a fflush after every \n */ |
105 | setlinebuf(stdout); | 103 | setlinebuf(stdout); |