X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=inittab.c;h=d73e0b87758a21a4153c00ce3c839b40f84bda9b;hp=2ed1395d884423134d205fd948f385987885e2c5;hb=eed8e77dcf5b9ce9c21919ea6d549b5dd92bb18a;hpb=0c116c65f9bc4132fa0dfc99e875f57e9ee29af1 diff --git a/inittab.c b/inittab.c index 2ed1395..d73e0b8 100644 --- a/inittab.c +++ b/inittab.c @@ -139,7 +139,7 @@ static void askconsole(struct init_action *a) regex_t pat_cmdline; regmatch_t matches[2]; - if (!fd) + if (fd < 0) return; r = read(fd, line, sizeof(line) - 1); @@ -175,6 +175,15 @@ err_out: regfree(&pat_cmdline); } +static void rcrespawn(struct init_action *a) +{ + a->tout.cb = respawn; + a->respawn = 500; + + a->proc.cb = child_exit; + fork_worker(a); +} + static struct init_handler handlers[] = { { .name = "sysinit", @@ -190,6 +199,10 @@ static struct init_handler handlers[] = { .name = "askconsole", .cb = askconsole, .multi = 1, + }, { + .name = "respawn", + .cb = rcrespawn, + .multi = 1, } };