summaryrefslogtreecommitdiff
path: root/src/initctl
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-08-07 10:06:49 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-08-07 10:06:49 +0900
commit73e47c42ab5ec6b99de34c5e673f4fc3d5cf1b6e (patch)
treeccc8b539db37fe79c14ad051399e09b59e18137f /src/initctl
parent4027f96aa08c73f109aa46b89842ca0e25c9c0e9 (diff)
downloadsystemd-73e47c42ab5ec6b99de34c5e673f4fc3d5cf1b6e.tar.gz
initctl: do not ignore errors in function
Diffstat (limited to 'src/initctl')
-rw-r--r--src/initctl/initctl.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
index 0c5aab6968..c93c02bf48 100644
--- a/src/initctl/initctl.c
+++ b/src/initctl/initctl.c
@@ -81,7 +81,7 @@ static const char *translate_runlevel(int runlevel, bool *isolate) {
return NULL;
}
-static void change_runlevel(Server *s, int runlevel) {
+static int change_runlevel(Server *s, int runlevel) {
const char *target;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
const char *mode;
@@ -93,7 +93,7 @@ static void change_runlevel(Server *s, int runlevel) {
target = translate_runlevel(runlevel, &isolate);
if (!target) {
log_warning("Got request for unknown runlevel %c, ignoring.", runlevel);
- return;
+ return 0;
}
if (isolate)
@@ -112,10 +112,10 @@ static void change_runlevel(Server *s, int runlevel) {
&error,
NULL,
"ss", target, mode);
- if (r < 0) {
- log_error("Failed to change runlevel: %s", bus_error_message(&error, -r));
- return;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to change runlevel: %s", bus_error_message(&error, -r));
+
+ return 0;
}
static void request_process(Server *s, const struct init_request *req) {
@@ -156,7 +156,7 @@ static void request_process(Server *s, const struct init_request *req) {
break;
default:
- change_runlevel(s, req->runlevel);
+ (void) change_runlevel(s, req->runlevel);
}
return;