mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
Minor whitespace and comment cleanup
- Comments preferably at beginning of func/sect - Reorder code slightly, add whitespace for readability - Drop useless comment Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -131,7 +131,7 @@ static int do_signal_svc(svc_t *svc, void *user_data)
|
||||
|
||||
static int do_signal(char *buf, size_t len, int sig)
|
||||
{
|
||||
/* Sanity check: Do we know this signal!? */
|
||||
/* Sanity check: do we know this signal? */
|
||||
if (!*sig2str(sig))
|
||||
return 1;
|
||||
|
||||
@@ -468,9 +468,10 @@ static void api_cb(uev_t *w, void *arg, int events)
|
||||
goto leave;
|
||||
|
||||
case INIT_CMD_SIGNAL:
|
||||
/* runlevel is reused for signal */
|
||||
_d("svc signal %d: %s", rq.runlevel, rq.data);
|
||||
strterm(rq.data, sizeof(rq.data));
|
||||
result = do_signal(rq.data, sizeof(rq.data), rq.runlevel /* runlevel is reused for signal! */);
|
||||
result = do_signal(rq.data, sizeof(rq.data), rq.runlevel);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
+8
-6
@@ -278,10 +278,10 @@ static int do_restart(char *arg)
|
||||
|
||||
/**
|
||||
* do_signal - Ask finit to send a signal to a service.
|
||||
* @argv: must point to an array of strings, containing a service
|
||||
* @argv: must point to an array of strings, containing a service
|
||||
* and signal name, in that order.
|
||||
* @argc: must be 2.
|
||||
*
|
||||
*
|
||||
* A signal can be a complete signal name such as "SIGHUP", or
|
||||
* it can be the shortest unique name, such as "HUP" (no SIG prefix).
|
||||
* It can also be a raw signal number, such as "9" (SIGKILL).
|
||||
@@ -297,7 +297,7 @@ int do_signal(int argc, char **argv)
|
||||
|
||||
if (argc != 2)
|
||||
errx(1, "invalid number of arguments to signal");
|
||||
|
||||
|
||||
/* Validate service name */
|
||||
strlcpy(rq.data, argv[0], sizeof(rq.data));
|
||||
if (client_send(&rq, sizeof(rq))) {
|
||||
@@ -319,10 +319,12 @@ int do_signal(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
rq.magic = INIT_MAGIC;
|
||||
rq.cmd = INIT_CMD_SIGNAL;
|
||||
/* Reuse runlevel for signal number. */
|
||||
rq.magic = INIT_MAGIC;
|
||||
rq.cmd = INIT_CMD_SIGNAL;
|
||||
rq.runlevel = signo;
|
||||
strlcpy(rq.data, argv[0], sizeof(rq.data));
|
||||
rq.runlevel = signum; /* Reuse runlevel for signal number. */
|
||||
|
||||
return client_send(&rq, sizeof(rq));
|
||||
|
||||
show_usage:
|
||||
|
||||
+1
-5
@@ -278,7 +278,7 @@ char *sig2str(int sig)
|
||||
/**
|
||||
* str2sig - Translate signal name to the corresponding signal number.
|
||||
* @sig: The name of the signal
|
||||
*
|
||||
*
|
||||
* A signal can be a complete signal name such as "SIGHUP", or
|
||||
* it can be the shortest unique name, such as "HUP" (no SIG prefix).
|
||||
*/
|
||||
@@ -287,10 +287,6 @@ int str2sig(char *sig)
|
||||
int name_offset = 0;
|
||||
size_t i;
|
||||
|
||||
/* if sig name starts with "SIG", then skip the first
|
||||
* three characters. signames holds the names without
|
||||
* the "SIG" prefix.
|
||||
*/
|
||||
if (strncasecmp(sig, "SIG", 3) == 0) {
|
||||
name_offset = 3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user