summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-15 20:05:37 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-15 20:05:37 +0000
commitbb23c069191f18ed11b826371ed3571e214b41e3 (patch)
tree8a7afbb2ead270f08c3fa4741da0522418142787 /include
parent9f7b92a2e13b184b1d6f7d9fbddc133666224bcf (diff)
downloadbusybox-w32-bb23c069191f18ed11b826371ed3571e214b41e3.tar.gz
busybox-w32-bb23c069191f18ed11b826371ed3571e214b41e3.tar.bz2
busybox-w32-bb23c069191f18ed11b826371ed3571e214b41e3.zip
if pidfile turned out to be !regular file, do not unlink it.
It's most probably the /dev/null.
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/libbb.h b/include/libbb.h
index fc0a0ae6c..d60b410ae 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -622,12 +622,14 @@ llist_t *llist_rev(llist_t *list);
622/* start_stop_daemon and udhcpc are special - they want 622/* start_stop_daemon and udhcpc are special - they want
623 * to create pidfiles regardless of FEATURE_PIDFILE */ 623 * to create pidfiles regardless of FEATURE_PIDFILE */
624#if ENABLE_FEATURE_PIDFILE || defined(WANT_PIDFILE) 624#if ENABLE_FEATURE_PIDFILE || defined(WANT_PIDFILE)
625int write_pidfile(const char *path); 625/* True only if we created pidfile which is *file*, not /dev/null etc */
626#define remove_pidfile(f) ((void)unlink(f)) 626extern smallint wrote_pidfile;
627void write_pidfile(const char *path);
628#define remove_pidfile(path) do { if (wrote_pidfile) unlink(path); } while (0)
627#else 629#else
628/* Why? #defining it to 1 gives "warning: statement with no effect"... */ 630enum { wrote_pidfile = 0 };
629static ALWAYS_INLINE int write_pidfile(const char *path) { return 1; } 631#define write_pidfile(path) ((void)0)
630#define remove_pidfile(f) ((void)0) 632#define remove_pidfile(path) ((void)0)
631#endif 633#endif
632 634
633enum { 635enum {