aboutsummaryrefslogtreecommitdiff
path: root/src/sysvinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysvinit.c')
-rw-r--r--src/sysvinit.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/sysvinit.c b/src/sysvinit.c
index a150058..9043619 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -529,6 +529,8 @@ sysvinit_fifo_handler (int fd, void *data)
{
debug (1, ("INITREQ: cmd=%d, runlevel=%d, sleeptime=%d",
buf.req.cmd, buf.req.runlevel, buf.req.sleeptime));
+ if (buf.req.sleeptime > 0)
+ shutdown_timeout = buf.req.sleeptime;
switch (buf.req.cmd)
{
case INIT_CMD_RUNLVL:
@@ -907,25 +909,19 @@ is_comp_wait (struct component *comp)
}
return 0;
}
-
+
+#include "telinit.h"
+
int
-telinit (const char *arg)
+telinit (int argc, char **argv)
{
int fd;
struct sysvinit_request req;
-
- if (arg[1] || !is_valid_runlevel (*arg))
- {
- logmsg (LOG_CRIT, "invalid argument");
- exit (EX_USAGE);
- }
+
memset (&req, 0, sizeof (req));
req.magic = INIT_MAGIC;
- req.cmd = INIT_CMD_RUNLVL;
- req.runlevel = *arg;
-#if 0
- req.sleeptime = sltime;
-#endif
+
+ telinit_parser (&req, argc, argv);
signal (SIGALRM, SIG_DFL);
alarm (5);
@@ -933,17 +929,17 @@ telinit (const char *arg)
if (fd < 0)
{
logmsg (LOG_ERR, _("cannot open %s: %s"), init_fifo, strerror (errno));
- exit (EX_UNAVAILABLE);
+ return EX_UNAVAILABLE;
}
if (write (fd, &req, sizeof (req)) != sizeof (req))
{
logmsg (LOG_ERR, _("error writing to %s: %s"),
init_fifo, strerror (errno));
- exit (EX_UNAVAILABLE);
+ return EX_UNAVAILABLE;
}
alarm (0);
close (fd);
- exit (0);
+ return 0;
}
static char *

Return to:

Send suggestions and report system problems to the System administrator.