aboutsummaryrefslogtreecommitdiff
path: root/runit/svlogd.c
diff options
context:
space:
mode:
Diffstat (limited to 'runit/svlogd.c')
-rw-r--r--runit/svlogd.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/runit/svlogd.c b/runit/svlogd.c
index e454bace8..fb834a403 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -153,12 +153,10 @@ static unsigned processorstart(struct logdir *ld)
153 if (verbose) 153 if (verbose)
154 bb_error_msg(INFO"processing: %s/%s", ld->name, ld->fnsave); 154 bb_error_msg(INFO"processing: %s/%s", ld->name, ld->fnsave);
155 fd = xopen(ld->fnsave, O_RDONLY|O_NDELAY); 155 fd = xopen(ld->fnsave, O_RDONLY|O_NDELAY);
156 if (fd_move(0, fd) == -1) 156 xmove_fd(fd, 0);
157 bb_perror_msg_and_die(FATAL"cannot %s processor %s", "move filedescriptor for", ld->name);
158 ld->fnsave[26] = 't'; 157 ld->fnsave[26] = 't';
159 fd = xopen(ld->fnsave, O_WRONLY|O_NDELAY|O_TRUNC|O_CREAT); 158 fd = xopen(ld->fnsave, O_WRONLY|O_NDELAY|O_TRUNC|O_CREAT);
160 if (fd_move(1, fd) == -1) 159 xmove_fd(fd, 1);
161 bb_perror_msg_and_die(FATAL"cannot %s processor %s", "move filedescriptor for", ld->name);
162 fd = open_read("state"); 160 fd = open_read("state");
163 if (fd == -1) { 161 if (fd == -1) {
164 if (errno != ENOENT) 162 if (errno != ENOENT)
@@ -166,17 +164,15 @@ static unsigned processorstart(struct logdir *ld)
166 close(xopen("state", O_WRONLY|O_NDELAY|O_TRUNC|O_CREAT)); 164 close(xopen("state", O_WRONLY|O_NDELAY|O_TRUNC|O_CREAT));
167 fd = xopen("state", O_RDONLY|O_NDELAY); 165 fd = xopen("state", O_RDONLY|O_NDELAY);
168 } 166 }
169 if (fd_move(4, fd) == -1) 167 xmove_fd(fd, 4);
170 bb_perror_msg_and_die(FATAL"cannot %s processor %s", "move filedescriptor for", ld->name);
171 fd = xopen("newstate", O_WRONLY|O_NDELAY|O_TRUNC|O_CREAT); 168 fd = xopen("newstate", O_WRONLY|O_NDELAY|O_TRUNC|O_CREAT);
172 if (fd_move(5, fd) == -1) 169 xmove_fd(fd, 5);
173 bb_perror_msg_and_die(FATAL"cannot %s processor %s", "move filedescriptor for", ld->name);
174 170
175// getenv("SHELL")? 171// getenv("SHELL")?
176 prog[0] = (char*)"sh"; 172 prog[0] = (char*)"sh";
177 prog[1] = (char*)"-c"; 173 prog[1] = (char*)"-c";
178 prog[2] = ld->processor; 174 prog[2] = ld->processor;
179 prog[3] = '\0'; 175 prog[3] = NULL;
180 execve("/bin/sh", prog, environ); 176 execve("/bin/sh", prog, environ);
181 bb_perror_msg_and_die(FATAL"cannot %s processor %s", "run", ld->name); 177 bb_perror_msg_and_die(FATAL"cannot %s processor %s", "run", ld->name);
182 } 178 }