aboutsummaryrefslogtreecommitdiff
path: root/debianutils/start_stop_daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'debianutils/start_stop_daemon.c')
-rw-r--r--debianutils/start_stop_daemon.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 733fb4112..6f8fb2dc8 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -3,31 +3,22 @@
3 * Mini start-stop-daemon implementation(s) for busybox 3 * Mini start-stop-daemon implementation(s) for busybox
4 * 4 *
5 * Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>, 5 * Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
6 * public domain.
7 * Adapted for busybox David Kimdon <dwhedon@gordian.com> 6 * Adapted for busybox David Kimdon <dwhedon@gordian.com>
7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */ 9 */
9 10
10#include "busybox.h" 11#include "busybox.h"
11#include <stdio.h> 12#include <getopt.h>
12#include <stdlib.h>
13#include <string.h>
14#include <stdarg.h>
15#include <signal.h>
16#include <errno.h>
17#include <sys/stat.h>
18#include <dirent.h>
19#include <unistd.h>
20#include <getopt.h> /* struct option */
21#include "pwd_.h"
22 13
23static int signal_nr = 15; 14static int signal_nr = 15;
24static int user_id = -1; 15static int user_id = -1;
25static int quiet; 16static int quiet;
26static char *userspec = NULL; 17static char *userspec;
27static char *chuid = NULL; 18static char *chuid;
28static char *cmdname = NULL; 19static char *cmdname;
29static char *execname = NULL; 20static char *execname;
30static char *pidfile = NULL; 21static char *pidfile;
31 22
32struct pid_list { 23struct pid_list {
33 struct pid_list *next; 24 struct pid_list *next;
@@ -136,7 +127,7 @@ static void do_procinit(void)
136 return; 127 return;
137 } 128 }
138 129
139 procdir = bb_xopendir("/proc"); 130 procdir = xopendir("/proc");
140 131
141 foundany = 0; 132 foundany = 0;
142 while ((entry = readdir(procdir)) != NULL) { 133 while ((entry = readdir(procdir)) != NULL) {
@@ -292,12 +283,12 @@ int start_stop_daemon_main(int argc, char **argv)
292 } 283 }
293 *--argv = startas; 284 *--argv = startas;
294 if (opt & SSD_OPT_BACKGROUND) { 285 if (opt & SSD_OPT_BACKGROUND) {
295 bb_xdaemon(0, 0); 286 xdaemon(0, 0);
296 setsid(); 287 setsid();
297 } 288 }
298 if (opt & SSD_OPT_MAKEPID) { 289 if (opt & SSD_OPT_MAKEPID) {
299 /* user wants _us_ to make the pidfile */ 290 /* user wants _us_ to make the pidfile */
300 FILE *pidf = bb_xfopen(pidfile, "w"); 291 FILE *pidf = xfopen(pidfile, "w");
301 292
302 pid_t pidt = getpid(); 293 pid_t pidt = getpid();
303 fprintf(pidf, "%d\n", pidt); 294 fprintf(pidf, "%d\n", pidt);