aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ctl.c16
-rw-r--r--src/pies.c3
2 files changed, 15 insertions, 4 deletions
diff --git a/src/ctl.c b/src/ctl.c
index eef1aae..f9f2d76 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -893,7 +893,7 @@ cmd_reboot (struct ctlio *io, size_t argc, char **argv)
{
io->action = ACTION_RESTART;
io->state = CTL_ACTION_STATE;
- ctlio_reply (io, "250", "Rebooting, closing connection");
+ ctlio_reply (io, "221", "Rebooting, closing connection");
}
static void
@@ -901,7 +901,7 @@ cmd_shutdown (struct ctlio *io, size_t argc, char **argv)
{
io->action = ACTION_STOP;
io->state = CTL_ACTION_STATE;
- ctlio_reply (io, "250", "Shuttign down, connection will be closed");
+ ctlio_reply (io, "221", "Shutting down, connection will be closed");
}
static int ctlrd (int fd, void *data);
@@ -951,7 +951,17 @@ ctlwr (int fd, void *data)
struct ctlio *io = data;
// logmsg (LOG_DEBUG, "%s called", __FUNCTION__);
if (ctlbuf_read (&io->obuf, &c, 1))
- write (fd, &c, 1);
+ {
+ ssize_t rc = write (fd, &c, 1);
+ if (rc != 1) {
+ if (rc == 0)
+ logmsg (LOG_ERR, "error writing to control socket");
+ else
+ logmsg (LOG_ERR, "error writing to control socket: %s",
+ strerror (errno));
+ return ctlio_end (fd, io);
+ }
+ }
else if (io->state == CTL_END_STATE)
return ctlio_end (fd, io);
else if (io->state == CTL_ACTION_STATE)
diff --git a/src/pies.c b/src/pies.c
index 9aa1a37..696e9f0 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -1868,7 +1868,8 @@ static int default_sigv[] = {
SIGHUP,
SIGALRM,
SIGUSR1,
- SIGUSR2
+ SIGUSR2,
+ SIGPIPE
};
static int extra_sigv[PIES_MAXSIG];

Return to:

Send suggestions and report system problems to the System administrator.