diff options
author | Eric Andersen | 2003-07-28 07:40:39 +0000 |
---|---|---|
committer | Eric Andersen | 2003-07-28 07:40:39 +0000 |
commit | 35e643b39f6cc77b702c714cfa8e70f1e10601a9 (patch) | |
tree | ad6b608081a4dde117563a1f1e9a6e3892a8752c /libbb | |
parent | 4f4631732cab5886105d8809d4e9b17711def65b (diff) | |
download | busybox-35e643b39f6cc77b702c714cfa8e70f1e10601a9.zip busybox-35e643b39f6cc77b702c714cfa8e70f1e10601a9.tar.gz |
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
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Makefile.in | 2 | ||||
-rw-r--r-- | libbb/vfork_daemon_rexec.c | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/libbb/Makefile.in b/libbb/Makefile.in index c4886e3..b60adc9 100644 --- a/libbb/Makefile.in +++ b/libbb/Makefile.in @@ -48,7 +48,7 @@ LIBBB_SRC:= \ fclose_nonstdin.c fflush_stdout_and_exit.c getopt_ulflags.c \ default_error_retval.c wfopen_input.c speed_table.c \ perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c \ - warn_ignoring_args.c concat_subpath_file.c + warn_ignoring_args.c concat_subpath_file.c vfork_daemon_rexec.c LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC)) diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c new file mode 100644 index 0000000..c8f9d27 --- /dev/null +++ b/libbb/vfork_daemon_rexec.c @@ -0,0 +1,27 @@ +/* + * Rexec program for system have fork() as vfork() with foregound option + * Copyright (C) Vladminr Oleynik and many different people. + */ + +#include <unistd.h> +#include "libbb.h" + + +#if defined(__uClinux__) +void vfork_daemon_rexec(int argc, char **argv, char *foreground_opt) +{ + char **vfork_args; + int a = 0; + + vfork_args = xcalloc(sizeof(char *), argc + 3); + while(*argv) { + vfork_args[a++] = *argv; + argv++; + } + vfork_args[a] = foreground_opt; + execvp("/proc/self/exe", vfork_args); + vfork_args[0] = "/bin/busybox"; + execv(vfork_args[0], vfork_args); + bb_perror_msg_and_die("execv %s", vfork_args[0]); +} +#endif /* uClinux */ |