summaryrefslogtreecommitdiff
path: root/src/machine/machinectl.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 18:50:43 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 18:56:16 +0100
commitf647962d64e844689f3e2acfce6102fc47e76df2 (patch)
treedcaf5e38de1d4e31f73f540bc85532ceb72cfa6b /src/machine/machinectl.c
parente80733be33e52d8ab2f1ae845326d39c600f5612 (diff)
treewide: yet more log_*_errno + return simplifications
Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
Diffstat (limited to 'src/machine/machinectl.c')
-rw-r--r--src/machine/machinectl.c48
1 files changed, 16 insertions, 32 deletions
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 52cdfda627..6db9e5c91b 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -414,10 +414,8 @@ static int show_info(const char *verb, sd_bus *bus, const char *path, bool *new_
path,
map,
&info);
- if (r < 0) {
- log_error_errno(r, "Could not get properties: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not get properties: %m");
if (*new_line)
printf("\n");
@@ -681,16 +679,12 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) {
}
r = sd_event_default(&event);
- if (r < 0) {
- log_error_errno(r, "Failed to get event loop: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to get event loop: %m");
r = sd_bus_attach_event(bus, event, 0);
- if (r < 0) {
- log_error_errno(r, "Failed to attach bus to event loop: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to attach bus to event loop: %m");
r = sd_bus_call_method(
bus,
@@ -719,20 +713,16 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) {
&error,
&reply2,
"u");
- if (r < 0) {
- log_error_errno(r, "Failed to retrieve PID of leader: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to retrieve PID of leader: %m");
r = sd_bus_message_read(reply2, "u", &leader);
if (r < 0)
return bus_log_parse_error(r);
master = openpt_in_namespace(leader, O_RDWR|O_NOCTTY|O_CLOEXEC|O_NDELAY);
- if (master < 0) {
- log_error_errno(master, "Failed to acquire pseudo tty: %m");
- return master;
- }
+ if (master < 0)
+ return log_error_errno(master, "Failed to acquire pseudo tty: %m");
pty = ptsname(master);
if (!pty) {
@@ -747,10 +737,8 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) {
}
r = sd_bus_open_system_container(&container_bus, args[1]);
- if (r < 0) {
- log_error_errno(r, "Failed to get container bus: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to get container bus: %m");
getty = strjoin("container-getty@", p, ".service", NULL);
if (!getty)
@@ -785,16 +773,12 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) {
sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL);
r = pty_forward_new(event, master, &forward);
- if (r < 0) {
- log_error_errno(r, "Failed to create PTY forwarder: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to create PTY forwarder: %m");
r = sd_event_loop(event);
- if (r < 0) {
- log_error_errno(r, "Failed to run event loop: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to run event loop: %m");
forward = pty_forward_free(forward);