diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-01-28 15:18:01 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-01-28 15:18:01 +0100 |
commit | d18c05f88e28762ae284b4a856cf03c3955eb6b7 (patch) | |
tree | 6be1ee16b19d35c3d2579c1d11695fe4706ca85e | |
parent | ca41090aaf4ffb25e87ed073990fe91cb18179ee (diff) | |
download | rvnit-d18c05f88e28762ae284b4a856cf03c3955eb6b7.tar.gz rvnit-d18c05f88e28762ae284b4a856cf03c3955eb6b7.tar.xz rvnit-d18c05f88e28762ae284b4a856cf03c3955eb6b7.zip |
close writing pipe end after oneshots finish
-rw-r--r-- | rvnit.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/rvnit.c b/rvnit.c index 816b6f9..f070ddd 100644 --- a/rvnit.c +++ b/rvnit.c @@ -182,6 +182,14 @@ restart(int i) } } +void +cleanup(int i) +{ + /* for oneshots, we don't need the pipe after exit */ + if (services[i].logfd[1] > 0) + close(services[i].logfd[1]); +} + int charsig(char c) { @@ -820,7 +828,7 @@ main(int argc, char *argv[]) goto fatal; } } - + cleanup(i); oneshot--; } else if (services[i].name[2] == 'D' || services[i].name[2] == 'G' || @@ -985,6 +993,7 @@ fatal: ; // arrives with level < 99 if (services[i].name[2] == 'K') { LOG("oneshot %s exited with status %d", services[i].name, services[i].status); + cleanup(i); oneshot--; } else if (services[i].name[2] == 'D') { LOG("daemon %s exited with status %d", services[i].name, services[i].status); |