summary refs log tree commit diff
path: root/src/svwaitdown.c
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2003-04-24 13:45:00 +0000
committerGerrit Pape <pape@smarden.org>2003-04-24 13:45:00 +0000
commitbfb861d2a12c98db9d54ba111888c5399b7eab16 (patch)
tree186a2a4d918407a17b555b11039709539b0c6854 /src/svwaitdown.c
parent09d95a67437f03dd8171e4b9c97a8ae5ba8e9e74 (diff)
downloadrunit-bfb861d2a12c98db9d54ba111888c5399b7eab16.tar.gz
runit-bfb861d2a12c98db9d54ba111888c5399b7eab16.tar.xz
runit-bfb861d2a12c98db9d54ba111888c5399b7eab16.zip
minor.
Diffstat (limited to 'src/svwaitdown.c')
-rw-r--r--src/svwaitdown.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/svwaitdown.c b/src/svwaitdown.c
index b10910b..f47354b 100644
--- a/src/svwaitdown.c
+++ b/src/svwaitdown.c
@@ -64,15 +64,12 @@ int main(int argc, const char * const *argv) {
   argv +=optind;
   if (! argv || ! *argv) usage();
 
-  dir =argv;
-  while (*dir) {
-    if ((fd =open_write("supervise/control")) == -1) {
-      dir++; /* bummer */
-      continue;
-    }
+  for (dir =argv; *dir; ++dir) {
+    if (*dir[0] != '/') continue; /* bummer */
+    if (chdir(*dir) == -1) continue; /* bummer */
+    if ((fd =open_write("supervise/control")) == -1) continue; /* bummer */
     if (write(fd, "dx", 1 +doexit) != (1 +doexit)) {
-      close(fd); dir++; /* bummer */
-      continue;
+      close(fd); continue; /* bummer */
     }
     close(fd);
   }