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 | |
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).
-rw-r--r-- | package/CHANGES | 2 | ||||
-rw-r--r-- | src/runsv.c | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/package/CHANGES b/package/CHANGES index 1d71647..144105f 100644 --- a/package/CHANGES +++ b/package/CHANGES @@ -6,6 +6,8 @@ Poumeyrol) * chpst.c, svwaitdown.c, svwaitup.c: fix checks for return value of open_* functions (thx David Reiss). + * runsv.c: exit with error if [log/]supervise/control exists, but is + not a fifo (thx Charlie Brady). 2.0.0 Sun, 15 Jun 2008 15:31:05 +0000 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); |