diff options
author | Denis Vlasenko | 2007-08-15 20:05:37 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-08-15 20:05:37 +0000 |
commit | bb23c069191f18ed11b826371ed3571e214b41e3 (patch) | |
tree | 8a7afbb2ead270f08c3fa4741da0522418142787 /include/libbb.h | |
parent | 9f7b92a2e13b184b1d6f7d9fbddc133666224bcf (diff) | |
download | busybox-bb23c069191f18ed11b826371ed3571e214b41e3.zip busybox-bb23c069191f18ed11b826371ed3571e214b41e3.tar.gz |
if pidfile turned out to be !regular file, do not unlink it.
It's most probably the /dev/null.
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/include/libbb.h b/include/libbb.h index fc0a0ae..d60b410 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -622,12 +622,14 @@ llist_t *llist_rev(llist_t *list); /* start_stop_daemon and udhcpc are special - they want * to create pidfiles regardless of FEATURE_PIDFILE */ #if ENABLE_FEATURE_PIDFILE || defined(WANT_PIDFILE) -int write_pidfile(const char *path); -#define remove_pidfile(f) ((void)unlink(f)) +/* True only if we created pidfile which is *file*, not /dev/null etc */ +extern smallint wrote_pidfile; +void write_pidfile(const char *path); +#define remove_pidfile(path) do { if (wrote_pidfile) unlink(path); } while (0) #else -/* Why? #defining it to 1 gives "warning: statement with no effect"... */ -static ALWAYS_INLINE int write_pidfile(const char *path) { return 1; } -#define remove_pidfile(f) ((void)0) +enum { wrote_pidfile = 0 }; +#define write_pidfile(path) ((void)0) +#define remove_pidfile(path) ((void)0) #endif enum { |