diff options
author | Denis Vlasenko | 2006-11-18 22:03:26 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-11-18 22:03:26 +0000 |
commit | 61126ab30a90b74e45a79ccb97074ab71afa6054 (patch) | |
tree | cbc4d021bafef2561cbb37ea0d0c955bfd985401 /networking/udhcp/pidfile.c | |
parent | 5a3395bc01cd4b11309595a6ecdaf32f8279f378 (diff) | |
download | busybox-61126ab30a90b74e45a79ccb97074ab71afa6054.zip busybox-61126ab30a90b74e45a79ccb97074ab71afa6054.tar.gz |
small fixes: using fd-based io instead of FILE*-based,
missed O_TRUNC, etc
Diffstat (limited to 'networking/udhcp/pidfile.c')
-rw-r--r-- | networking/udhcp/pidfile.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/networking/udhcp/pidfile.c b/networking/udhcp/pidfile.c index 8d00490..bcb2608 100644 --- a/networking/udhcp/pidfile.c +++ b/networking/udhcp/pidfile.c @@ -23,7 +23,7 @@ #include "common.h" -static char *saved_pidfile; +static const char *saved_pidfile; static void pidfile_delete(void) { @@ -36,14 +36,14 @@ int pidfile_acquire(const char *pidfile) int pid_fd; if (!pidfile) return -1; - pid_fd = open(pidfile, O_CREAT | O_WRONLY, 0644); + pid_fd = open(pidfile, O_CREAT|O_WRONLY|O_TRUNC, 0644); if (pid_fd < 0) { - bb_perror_msg("unable to open pidfile %s", pidfile); + bb_perror_msg("cannot open pidfile %s", pidfile); } else { lockf(pid_fd, F_LOCK, 0); if (!saved_pidfile) atexit(pidfile_delete); - saved_pidfile = (char *) pidfile; + saved_pidfile = pidfile; } return pid_fd; |