mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
Minor refactor of error/debug messages
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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, ",")) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user