diff options
author | Gerrit Pape <pape@smarden.org> | 2009-09-24 21:42:53 +0000 |
---|---|---|
committer | Gerrit Pape <pape@smarden.org> | 2009-09-24 22:17:06 +0000 |
commit | aa5b631c558dc19f2c421938dd5ed3db418cd232 (patch) | |
tree | c112afc9420fdafe1ed5f7a67d30ef6d718669e4 /src | |
parent | e85e4f3238c022b89d130cb4765282ed7f0b183c (diff) | |
download | runit-aa5b631c558dc19f2c421938dd5ed3db418cd232.tar.gz runit-aa5b631c558dc19f2c421938dd5ed3db418cd232.tar.xz runit-aa5b631c558dc19f2c421938dd5ed3db418cd232.zip |
* runsv.c: exit with error if [log/]supervise/control exists, but is
not a fifo (thx Charlie Brady).
Diffstat (limited to 'src')
-rw-r--r-- | src/runsv.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runsv.c b/src/runsv.c index 9ae8522..ecf4677 100644 --- a/src/runsv.c +++ b/src/runsv.c @@ -479,6 +479,10 @@ int main(int argc, char **argv) { } fifo_make("supervise/control", 0600); + if (stat("supervise/control", &s) == -1) + fatal("unable to stat supervise/control"); + if (!S_ISFIFO(s.st_mode)) + fatalx("supervise/control exists but is not a fifo", ""); if ((svd[0].fdcontrol =open_read("supervise/control")) == -1) fatal("unable to open supervise/control"); coe(svd[0].fdcontrol); @@ -488,6 +492,10 @@ int main(int argc, char **argv) { update_status(&svd[0]); if (haslog) { fifo_make("log/supervise/control", 0600); + if (stat("supervise/control", &s) == -1) + fatal("unable to stat log/supervise/control"); + if (!S_ISFIFO(s.st_mode)) + fatalx("log/supervise/control exists but is not a fifo", ""); if ((svd[1].fdcontrol =open_read("log/supervise/control")) == -1) fatal("unable to open log/supervise/control"); coe(svd[1].fdcontrol); |