commit 86153df4a1385ca15820207fd83bac5312503a72 parent 3d82b2f9f184c4261bf330eb2e95b6de80435d21 Author: Gerrit Pape <pape@smarden.org> Date: Thu, 24 Apr 2003 13:45:00 +0000 minor. Diffstat:
M | src/svwaitdown.c | | | 13 | +++++-------- |
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git 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); }