aboutsummaryrefslogtreecommitdiff
path: root/runit
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-03-17 09:13:22 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-03-17 09:13:22 +0000
commit4ee7cd4f6f9f85871c8814bb524d3e691a2992a9 (patch)
treec1ca93c475e72736cfee70eaaa631f499da3b7e0 /runit
parentaa9b1828b91bc4b60f1164b7929a6a0ac091419e (diff)
downloadbusybox-4ee7cd4f6f9f85871c8814bb524d3e691a2992a9.tar.gz
busybox-4ee7cd4f6f9f85871c8814bb524d3e691a2992a9.tar.bz2
*: mode tcp/udpsvd to networking, delete ipsvd/*
*/Config.in: fixes to text svlogd: make it NOMMU capable function old new delta processorstart 378 420 +42 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 42/0) Total: 42 bytes text data bss dec hex filename 797153 662 7420 805235 c4973 busybox_old 797196 662 7420 805278 c499e busybox_unstripped
Diffstat (limited to 'runit')
-rw-r--r--runit/svlogd.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 4458bd787..db3d4c540 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -206,17 +206,22 @@ static void fmt_time_bernstein_25(char *s)
bin2hex(s, (char*)pack, 12);
}
-static unsigned processorstart(struct logdir *ld)
+static void processorstart(struct logdir *ld)
{
+ char sv_ch;
int pid;
- if (!ld->processor) return 0;
+ if (!ld->processor) return;
if (ld->ppid) {
warnx("processor already running", ld->name);
- return 0;
+ return;
}
- while ((pid = fork()) == -1)
- pause2cannot("fork for processor", ld->name);
+
+ /* vfork'ed child trashes this byte, save... */
+ sv_ch = ld->fnsave[26];
+
+ while ((pid = vfork()) == -1)
+ pause2cannot("vfork for processor", ld->name);
if (!pid) {
char *prog[4];
int fd;
@@ -235,7 +240,7 @@ static unsigned processorstart(struct logdir *ld)
bb_error_msg(INFO"processing: %s/%s", ld->name, ld->fnsave);
fd = xopen(ld->fnsave, O_RDONLY|O_NDELAY);
xmove_fd(fd, 0);
- ld->fnsave[26] = 't';
+ ld->fnsave[26] = 't'; /* <- that's why we need sv_ch! */
fd = xopen(ld->fnsave, O_WRONLY|O_NDELAY|O_TRUNC|O_CREAT);
xmove_fd(fd, 1);
fd = open_read("state");
@@ -257,8 +262,8 @@ static unsigned processorstart(struct logdir *ld)
execv("/bin/sh", prog);
bb_perror_msg_and_die(FATAL"cannot %s processor %s", "run", ld->name);
}
+ ld->fnsave[26] = sv_ch; /* ...restore */
ld->ppid = pid;
- return 1;
}
static unsigned processorstop(struct logdir *ld)