From 4b4572de4d6c9acd4d068df42fc4d2b7e3315a9b Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 8 Sep 2016 17:11:27 +0200 Subject: [PATCH] Minor refactor of error/debug messages Signed-off-by: Joachim Nilsson --- api.c | 6 +++--- exec.c | 4 ++-- getty.c | 2 +- inetd.c | 16 ++++++++-------- plugin.c | 4 ++-- service.c | 10 +++++----- sig.c | 6 +++--- tty.c | 4 ++-- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/api.c b/api.c index 40d29c53..8ee95a0f 100644 --- a/api.c +++ b/api.c @@ -246,7 +246,7 @@ static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events)) } if (rq.magic != INIT_MAGIC || len != sizeof(rq)) { - _e("Invalid initctl request."); + _e("Invalid initctl request"); break; } @@ -321,7 +321,7 @@ static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events)) break; case INIT_CMD_ACK: - _d("Client failed reading ACK."); + _d("Client failed reading ACK"); goto leave; default: @@ -335,7 +335,7 @@ static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events)) rq.cmd = INIT_CMD_ACK; len = write(sd, &rq, sizeof(rq)); if (len != sizeof(rq)) - _d("Failed sending ACK/NACK back to client."); + _d("Failed sending ACK/NACK back to client"); } leave: diff --git a/exec.c b/exec.c index 5a589f6c..cd594977 100644 --- a/exec.c +++ b/exec.c @@ -48,9 +48,9 @@ int complete(char *cmd, int pid) if (waitpid(pid, &status, 0) == -1) { if (errno == EINTR) - _e("Caught unblocked signal waiting for %s, aborting.", cmd); + _e("Caught unblocked signal waiting for %s, aborting", cmd); else if (errno == ECHILD) - _e("Caught SIGCHLD waiting for %s, aborting.", cmd); + _e("Caught SIGCHLD waiting for %s, aborting", cmd); else _e("Failed starting %s, error %d: %s", cmd, errno, strerror (errno)); diff --git a/getty.c b/getty.c index 6e366a1f..fee43d51 100644 --- a/getty.c +++ b/getty.c @@ -57,7 +57,7 @@ static int readch(char *tty) } if (st < 0) - errx(1, "getty: %s: read error.", tty); + errx(1, "getty: %s: read error", tty); return ch1 & 0xFF; } diff --git a/inetd.c b/inetd.c index 920d2a62..aae008c4 100755 --- a/inetd.c +++ b/inetd.c @@ -38,7 +38,7 @@ do { \ int val = 1; \ if (setsockopt(sd, level, opt, &val, sizeof(val)) < 0) \ - logit(LOG_CRIT, "Failed enabling %s on %s service.", \ + logit(LOG_CRIT, "Failed enabling %s on %s service", \ #opt, inetd->name); \ } while (0); @@ -126,7 +126,7 @@ static int get_stdin(svc_t *svc) } if (!inetd_is_allowed(&svc->inetd, ifname)) { - logit(LOG_INFO, "Service %s on %s:%d is not allowed.", svc->inetd.name, ifname, svc->inetd.port); + logit(LOG_INFO, "Service %s on %s:%d is not allowed", svc->inetd.name, ifname, svc->inetd.port); if (svc->inetd.type == SOCK_STREAM) close(stdin); @@ -226,7 +226,7 @@ static int spawn_socket(inetd_t *inetd) struct sockaddr_in s; if (!inetd->type) { - logit(LOG_CRIT, "Skipping invalid inetd service %s", inetd->name); + logit(LOG_CRIT, "Invalid inetd service %s, skipping ...", inetd->name); return -EINVAL; } @@ -383,11 +383,11 @@ static int getent(char *service, char *proto, struct servent **sv, struct protoe s.s_proto = proto; if (errstr || !s.s_proto) { - _e("Invalid/unknown inetd service, cannot create custom entry."); + _e("Invalid/unknown inetd service, cannot create custom entry"); return errno = EINVAL; } - _d("Creating cutom inetd service %s/%s.", service, proto); + _d("Creating cutom inetd service %s/%s", service, proto); s.s_port = htons(s.s_port); *sv = &s; } @@ -395,7 +395,7 @@ static int getent(char *service, char *proto, struct servent **sv, struct protoe if (pv && (*sv)->s_proto) { *pv = getent_proto((*sv)->s_proto); if (!*pv) { - _e("Cannot find proto %s, skipping.", (*sv)->s_proto); + _e("Cannot find proto %s, skipping ...", (*sv)->s_proto); return errno = EINVAL; } } @@ -470,7 +470,7 @@ int inetd_allow(inetd_t *inetd, char *ifname) filter = inetd_filter_match(inetd, ifname); if (filter) { - _d("Filter %s for inetd %s already exists, skipping.", ifname, inetd->name); + _d("Filter %s for inetd %s already exists, skipping ...", ifname, inetd->name); return 0; } @@ -500,7 +500,7 @@ int inetd_deny(inetd_t *inetd, char *ifname) filter = find_filter(inetd, ifname); if (filter) { - _d("%s filter %s for inetd %s already exists, cannot set deny filter for same, skipping.", + _d("%s filter %s for inetd %s already exists, cannot set deny filter for same, skipping ...", filter->deny ? "Deny" : "Allow", ifname, inetd->name); return 1; } diff --git a/plugin.c b/plugin.c index 4101d184..726d0683 100644 --- a/plugin.c +++ b/plugin.c @@ -87,7 +87,7 @@ int plugin_register(plugin_t *plugin) /* Already registered? */ if (plugin_find(plugin->name)) { - _d("... %s already loaded.", plugin->name); + _d("... %s already loaded", plugin->name); free(plugin->name); return 0; @@ -282,7 +282,7 @@ static int load_one(char *path, char *name) plugin = TAILQ_LAST(&plugins, plugin_head); if (!plugin) { - _e("Plugin %s failed to register, unloading from memory.", sofile); + _e("Plugin %s failed to register, unloading from memory", sofile); dlclose(handle); return 1; } diff --git a/service.c b/service.c index 8fc7d52e..5fe6cbe2 100755 --- a/service.c +++ b/service.c @@ -476,7 +476,7 @@ int service_register(int type, char *line, time_t mtime, char *username) plugin_t *plugin = NULL; if (!line) { - _e("Invalid input argument."); + _e("Invalid input argument"); return errno = EINVAL; } @@ -489,7 +489,7 @@ int service_register(int type, char *line, time_t mtime, char *username) cmd = strtok(line, " "); if (!cmd) { incomplete: - _e("Incomplete service, cannot register."); + _e("Incomplete service, cannot register"); return errno = ENOENT; } @@ -548,7 +548,7 @@ int service_register(int type, char *line, time_t mtime, char *username) plugin = plugin_find(ps); if (!plugin || !plugin->inetd.cmd) { - _w("Inetd service %s has no internal plugin, skipping.", service); + _w("Inetd service %s has no internal plugin, skipping ...", service); return errno = ENOENT; } } @@ -628,7 +628,7 @@ recreate: name = plugin->name; if (inetd_new(&svc->inetd, name, service, proto, forking, svc)) { - _e("Failed registering new inetd service %s.", service); + _e("Failed registering new inetd service %s", service); return svc_del(svc); } @@ -636,7 +636,7 @@ recreate: inetd_flush(&svc->inetd); if (!ifaces) { - _d("No specific iface listed for %s, allowing ANY.", service); + _d("No specific iface listed for %s, allowing ANY", service); inetd_allow(&svc->inetd, NULL); } else { for (iface = strtok(ifaces, ","); iface; iface = strtok(NULL, ",")) { diff --git a/sig.c b/sig.c index e4d0e665..3f7793a5 100644 --- a/sig.c +++ b/sig.c @@ -114,13 +114,13 @@ void do_shutdown(shutop_t op) utmp_set_halt(); /* Here is where we signal watchdogd to do a forced reset for us */ - _d("Sending SIGTERM to all processes."); + _d("Sending SIGTERM to all processes"); kill(-1, SIGTERM); /* Wait for WDT to timeout, should be no more than ~1 sec. */ do_sleep(2); - _d("Sending SIGKILL to remaining processes."); + _d("Sending SIGKILL to remaining processes"); kill(-1, SIGKILL); /* Exit plugins and API gracefully */ @@ -159,7 +159,7 @@ void do_shutdown(shutop_t op) /* Call mdadm to mark any RAID array(s) as clean before halting. */ mdadm_wait(); - _d("%s.", op == SHUT_REBOOT ? "Rebooting" : "Halting"); + _d("%s", op == SHUT_REBOOT ? "Rebooting" : "Halting"); if (op == SHUT_REBOOT) reboot(RB_AUTOBOOT); diff --git a/tty.c b/tty.c index 3740a9a7..e3373b77 100644 --- a/tty.c +++ b/tty.c @@ -45,14 +45,14 @@ int tty_register(char *line) char *runlevels = NULL, *term = NULL; if (!line) { - _e("Invalid input argument."); + _e("Invalid input argument"); return errno = EINVAL; } cmd = strtok(line, " "); if (!cmd) { incomplete: - _e("Incomplete tty, cannot register."); + _e("Incomplete tty, cannot register"); return errno = EINVAL; }