aboutsummaryrefslogtreecommitdiff
path: root/src/sysvinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysvinit.c')
-rw-r--r--src/sysvinit.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/sysvinit.c b/src/sysvinit.c
index 4fd4559..faa504a 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -399,6 +399,7 @@ sysvinit_setenv (char const *data, int size)
}
}
+char *init_fifo = INIT_FIFO;
static void create_fifo (void);
static int
@@ -415,14 +416,14 @@ sysvinit_fifo_handler (int fd, void *data)
rc = read (fd, buf.data + size, sizeof (struct sysvinit_request) - size);
if (rc == -1)
{
- logmsg (LOG_ERR, _("error reading from %s: %s"), INIT_FIFO,
+ logmsg (LOG_ERR, _("error reading from %s: %s"), init_fifo,
strerror (errno));
size = 0;
return 0;
}
if (rc == 0)
{
- logmsg (LOG_ERR, _("end of file on %s: reopening"), INIT_FIFO);
+ logmsg (LOG_ERR, _("end of file on %s: reopening"), init_fifo);
size = 0;
close (fd);
deregister_socket (fd);
@@ -470,17 +471,17 @@ create_fifo ()
static int fd = -1;
struct stat st, fst;
- if (stat (INIT_FIFO, &st) < 0)
+ if (stat (init_fifo, &st) < 0)
{
if (errno != ENOENT)
{
- logmsg (LOG_ERR, "cannot stat fifo %s: %s", INIT_FIFO,
+ logmsg (LOG_ERR, "cannot stat fifo %s: %s", init_fifo,
strerror (errno));
return;
}
- else if (mkfifo (INIT_FIFO, 0600))
+ else if (mkfifo (init_fifo, 0600))
{
- logmsg (LOG_ERR, "cannot create fifo %s: %s", INIT_FIFO,
+ logmsg (LOG_ERR, "cannot create fifo %s: %s", init_fifo,
strerror (errno));
return;
}
@@ -489,11 +490,11 @@ create_fifo ()
{
if (!S_ISFIFO (st.st_mode))
{
- logmsg (LOG_ERR, "not a fifo: %s", INIT_FIFO);
+ logmsg (LOG_ERR, "not a fifo: %s", init_fifo);
return;
}
- chmod (INIT_FIFO, 0600);
+ chmod (init_fifo, 0600);
}
if (fd != -1)
@@ -504,17 +505,17 @@ create_fifo ()
deregister_socket (fd);
close (fd);
}
- debug (1, ("reopening %s", INIT_FIFO));
+ debug (1, ("reopening %s", init_fifo));
}
/* Opening the socket in read-write mode ensures we won't get EOF
on it when the caller party closes connection (at least on Linux).
Nevertheless, the svinit_fifo_handler is prepared for that eventuality,
too. */
- fd = open (INIT_FIFO, O_RDWR|O_NONBLOCK);
+ fd = open (init_fifo, O_RDWR|O_NONBLOCK);
if (fd == -1)
{
- logmsg (LOG_ERR, "cannot open %s: %s", INIT_FIFO,
+ logmsg (LOG_ERR, "cannot open %s: %s", init_fifo,
strerror (errno));
return;
}
@@ -631,9 +632,10 @@ inittrans ()
newlevel = 'S';
break;
case normal:
- /* boot -> normal */
newlevel = dfl_level ? dfl_level : getinitdefault ();
- create_fifo ();
+ if (trans)
+ /* boot -> normal */
+ create_fifo ();
}
if (newlevel && newlevel != runlevel)
{
@@ -703,16 +705,16 @@ telinit (const char *arg)
signal (SIGALRM, SIG_DFL);
alarm (5);
- fd = open (INIT_FIFO, O_WRONLY);
+ fd = open (init_fifo, O_WRONLY);
if (fd < 0)
{
- logmsg (LOG_ERR, _("can't open %s: %s"), INIT_FIFO, strerror (errno));
+ logmsg (LOG_ERR, _("can't open %s: %s"), init_fifo, strerror (errno));
exit (EX_UNAVAILABLE);
}
if (write (fd, &req, sizeof (req)) != sizeof (req))
{
logmsg (LOG_ERR, _("error writing to %s: %s"),
- INIT_FIFO, strerror (errno));
+ init_fifo, strerror (errno));
exit (EX_UNAVAILABLE);
}
alarm (0);

Return to:

Send suggestions and report system problems to the System administrator.