runit

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

commit 0d34960dc67de0cd6ceccbac20a5c25ee285559d
parent 6a812c1c8587e05d0d4b00ac4618bf407c9e0f05
Author: Gerrit Pape <pape@smarden.org>
Date:   Thu, 24 Sep 2009 21:42:53 +0000

  * runsv.c: exit with error if [log/]supervise/control exists, but is
    not a fifo (thx Charlie Brady).

Diffstat:
Mpackage/CHANGES | 2++
Msrc/runsv.c | 8++++++++
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git 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 @@ -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);