aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debianutils/start_stop_daemon.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 9150763cb..7a0d1166f 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -32,6 +32,7 @@ struct globals {
32 int user_id; 32 int user_id;
33 smallint quiet; 33 smallint quiet;
34 smallint signal_nr; 34 smallint signal_nr;
35 struct stat execstat;
35}; 36};
36#define G (*(struct globals*)&bb_common_bufsiz1) 37#define G (*(struct globals*)&bb_common_bufsiz1)
37#define found (G.found ) 38#define found (G.found )
@@ -42,6 +43,7 @@ struct globals {
42#define user_id (G.user_id ) 43#define user_id (G.user_id )
43#define quiet (G.quiet ) 44#define quiet (G.quiet )
44#define signal_nr (G.signal_nr ) 45#define signal_nr (G.signal_nr )
46#define execstat (G.execstat )
45#define INIT_G() \ 47#define INIT_G() \
46 do { \ 48 do { \
47 user_id = -1; \ 49 user_id = -1; \
@@ -51,13 +53,12 @@ struct globals {
51 53
52static int pid_is_exec(pid_t pid) 54static int pid_is_exec(pid_t pid)
53{ 55{
54 struct stat st, execstat; 56 struct stat st;
55 char buf[sizeof("/proc//exe") + sizeof(int)*3]; 57 char buf[sizeof("/proc//exe") + sizeof(int)*3];
56 58
57 sprintf(buf, "/proc/%u/exe", pid); 59 sprintf(buf, "/proc/%u/exe", pid);
58 if (stat(buf, &st) < 0) 60 if (stat(buf, &st) < 0)
59 return 0; 61 return 0;
60 xstat(execname, &execstat);
61 if (st.st_dev == execstat.st_dev 62 if (st.st_dev == execstat.st_dev
62 && st.st_ino == execstat.st_ino) 63 && st.st_ino == execstat.st_ino)
63 return 1; 64 return 1;
@@ -299,6 +300,8 @@ int start_stop_daemon_main(int argc ATTRIBUTE_UNUSED, char **argv)
299 if (errno) 300 if (errno)
300 user_id = xuname2uid(userspec); 301 user_id = xuname2uid(userspec);
301 } 302 }
303 if (execname)
304 xstat(execname, &execstat);
302 305
303 do_procinit(); /* Both start and stop needs to know current processes */ 306 do_procinit(); /* Both start and stop needs to know current processes */
304 307