runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 9306eaf2b37bf093de723d013963ae7d7ecf9329
parent dffd2e7791b393c6fedbdb4fdc4a8925085bce39
Author: Gerrit Pape <pape@smarden.org>
Date:   Sun,  1 Aug 2004 18:30:14 +0000

  * runsvdir.c: check services dir again after one second until it's
    unchanged (thx Eric Lammerts); loop while chdir to starting dir fails.

Diffstat:
Mpackage/CHANGES | 4++++
Msrc/runsvdir.c | 24++++++++++++++----------
2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/package/CHANGES b/package/CHANGES @@ -1,5 +1,9 @@ +runit 1.0.4 +Sun, 01 Aug 2004 18:29:36 +0000 * doc/runlevels.html, doc/upgrade.html, doc/useinit.html, man/runsvdir.8, man/runsvchdir.8: minor changes in wording, notations. + * runsvdir.c: check services dir again after one second until it's + unchanged (thx Eric Lammerts); loop while chdir to starting dir fails. runit 1.0.3 Sat, 26 Jun 2004 14:50:41 +0000 diff --git a/src/runsvdir.c b/src/runsvdir.c @@ -117,11 +117,13 @@ void runsvdir() { sv[i].isgone =0; svnum++; runsv(i, d->d_name); + check =1; } } if (errno) { warn("unable to read directory ", svdir); closedir(dir); + check =1; return; } closedir(dir); @@ -220,17 +222,19 @@ int main(int argc, char **argv) { if (check || \ s.st_mtime > mtime || s.st_ino != ino || s.st_dev != dev) { /* svdir modified */ - mtime =s.st_mtime; - dev =s.st_dev; - ino =s.st_ino; - check =0; - if (chdir(svdir) == -1) - warn("unable to change directory to ", svdir); - else { + if (chdir(svdir) != -1) { + mtime =s.st_mtime; + dev =s.st_dev; + ino =s.st_ino; + check =0; runsvdir(); - if (fchdir(curdir) == -1) - warn("unable to change directory", 0); + while (fchdir(curdir) == -1) { + warn("unable to change directory, pausing", 0); + sleep(5); + } } + else + warn("unable to change directory to ", svdir); } } else @@ -243,7 +247,7 @@ int main(int argc, char **argv) { taia_uint(&deadline, 900); taia_add(&stamplog, &now, &deadline); } - taia_uint(&deadline, 5); + taia_uint(&deadline, check ? 1 : 5); taia_add(&deadline, &now, &deadline); sig_block(sig_child);