aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-28 07:40:39 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-28 07:40:39 +0000
commit62acfd880c121bebbe52f60a94e5d7e20ad933ca (patch)
treead6b608081a4dde117563a1f1e9a6e3892a8752c /libbb
parentd6d5411285a3c1247fda3b6912cee6754e07167d (diff)
downloadbusybox-w32-62acfd880c121bebbe52f60a94e5d7e20ad933ca.tar.gz
busybox-w32-62acfd880c121bebbe52f60a94e5d7e20ad933ca.tar.bz2
busybox-w32-62acfd880c121bebbe52f60a94e5d7e20ad933ca.zip
last_patch95 from vodz:
Hi. Last patch have new libbb function vfork_rexec() for can use daemon() to uClinux system. This patched daemons: syslog, klogd, inetd, crond. This not tested! I havn`t this systems. Also. Previous patch for feature request MD5 crypt password for httpd don`t sended to this mailist on 07/15/03 (mailist have Pytom module problem?). The previous patch included, and have testing. --w vodz git-svn-id: svn://busybox.net/trunk/busybox@7119 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Makefile.in2
-rw-r--r--libbb/vfork_daemon_rexec.c27
2 files changed, 28 insertions, 1 deletions
diff --git a/libbb/Makefile.in b/libbb/Makefile.in
index c4886e3ff..b60adc959 100644
--- a/libbb/Makefile.in
+++ b/libbb/Makefile.in
@@ -48,7 +48,7 @@ LIBBB_SRC:= \
48 fclose_nonstdin.c fflush_stdout_and_exit.c getopt_ulflags.c \ 48 fclose_nonstdin.c fflush_stdout_and_exit.c getopt_ulflags.c \
49 default_error_retval.c wfopen_input.c speed_table.c \ 49 default_error_retval.c wfopen_input.c speed_table.c \
50 perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c \ 50 perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c \
51 warn_ignoring_args.c concat_subpath_file.c 51 warn_ignoring_args.c concat_subpath_file.c vfork_daemon_rexec.c
52 52
53LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC)) 53LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC))
54 54
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
new file mode 100644
index 000000000..c8f9d277e
--- /dev/null
+++ b/libbb/vfork_daemon_rexec.c
@@ -0,0 +1,27 @@
1/*
2 * Rexec program for system have fork() as vfork() with foregound option
3 * Copyright (C) Vladminr Oleynik and many different people.
4 */
5
6#include <unistd.h>
7#include "libbb.h"
8
9
10#if defined(__uClinux__)
11void vfork_daemon_rexec(int argc, char **argv, char *foreground_opt)
12{
13 char **vfork_args;
14 int a = 0;
15
16 vfork_args = xcalloc(sizeof(char *), argc + 3);
17 while(*argv) {
18 vfork_args[a++] = *argv;
19 argv++;
20 }
21 vfork_args[a] = foreground_opt;
22 execvp("/proc/self/exe", vfork_args);
23 vfork_args[0] = "/bin/busybox";
24 execv(vfork_args[0], vfork_args);
25 bb_perror_msg_and_die("execv %s", vfork_args[0]);
26}
27#endif /* uClinux */