summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/activate/activate.c6
-rw-r--r--src/console/consoled-manager.c8
-rw-r--r--src/core/manager.c6
-rw-r--r--src/journal-remote/journal-remote.c47
-rw-r--r--src/journal-remote/journal-upload-journal.c55
-rw-r--r--src/journal-remote/journal-upload.c49
-rw-r--r--src/journal/catalog.c14
-rw-r--r--src/libsystemd-terminal/idev-keyboard.c11
-rw-r--r--src/libsystemd-terminal/sysview.c55
-rw-r--r--src/network/networkd-address.c138
10 files changed, 137 insertions, 252 deletions
diff --git a/src/activate/activate.c b/src/activate/activate.c
index 874b883617..a17babe076 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -65,10 +65,8 @@ static int open_sockets(int *epoll_fd, bool accept) {
int count = 0;
n = sd_listen_fds(true);
- if (n < 0) {
- log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
- return n;
- }
+ if (n < 0)
+ return log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
if (n > 0) {
log_info("Received %i descriptors via the environment.", n);
diff --git a/src/console/consoled-manager.c b/src/console/consoled-manager.c
index 0eac7ae78a..9dd62f04a0 100644
--- a/src/console/consoled-manager.c
+++ b/src/console/consoled-manager.c
@@ -141,11 +141,9 @@ static int manager_sysview_session_add(Manager *m, sysview_event *event) {
int r;
r = sysview_session_take_control(session);
- if (r < 0) {
- log_error_errno(r, "Cannot request session control on '%s': %m",
- sysview_session_get_name(session));
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Cannot request session control on '%s': %m",
+ sysview_session_get_name(session));
r = session_new(&s, m, session);
if (r < 0) {
diff --git a/src/core/manager.c b/src/core/manager.c
index c56c1621b0..f934594480 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -729,10 +729,8 @@ static int manager_setup_kdbus(Manager *m) {
m->running_as == SYSTEMD_SYSTEM ? "system" : "user",
m->running_as == SYSTEMD_SYSTEM, &p);
- if (m->kdbus_fd < 0) {
- log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m");
- return m->kdbus_fd;
- }
+ if (m->kdbus_fd < 0)
+ return log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m");
log_debug("Successfully set up kdbus on %s", p);
#endif
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index d1df83fba0..21309743fe 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -320,11 +320,9 @@ static int get_source_for_fd(RemoteServer *s,
return log_oom();
r = get_writer(s, name, &writer);
- if (r < 0) {
- log_warning_errno(r, "Failed to get writer for source %s: %m",
- name);
- return r;
- }
+ if (r < 0)
+ return log_warning_errno(r, "Failed to get writer for source %s: %m",
+ name);
if (s->sources[fd] == NULL) {
s->sources[fd] = source_new(fd, false, name, writer);
@@ -459,11 +457,9 @@ static int request_meta(void **connection_cls, int fd, char *hostname) {
return 0;
r = get_writer(server, hostname, &writer);
- if (r < 0) {
- log_warning_errno(r, "Failed to get writer for source %s: %m",
- hostname);
- return r;
- }
+ if (r < 0)
+ return log_warning_errno(r, "Failed to get writer for source %s: %m",
+ hostname);
source = source_new(fd, true, hostname, writer);
if (!source) {
@@ -855,10 +851,9 @@ static int remoteserver_init(RemoteServer *s,
return r;
n = sd_listen_fds(true);
- if (n < 0) {
- log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
- return n;
- } else
+ if (n < 0)
+ return log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
+ else
log_info("Received %d descriptors", n);
if (MAX(http_socket, https_socket) >= SD_LISTEN_FDS_START + n) {
@@ -1460,28 +1455,22 @@ static int load_certificates(char **key, char **cert, char **trust) {
int r;
r = read_full_file(arg_key ?: PRIV_KEY_FILE, key, NULL);
- if (r < 0) {
- log_error_errno(r, "Failed to read key from file '%s': %m",
- arg_key ?: PRIV_KEY_FILE);
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to read key from file '%s': %m",
+ arg_key ?: PRIV_KEY_FILE);
r = read_full_file(arg_cert ?: CERT_FILE, cert, NULL);
- if (r < 0) {
- log_error_errno(r, "Failed to read certificate from file '%s': %m",
- arg_cert ?: CERT_FILE);
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to read certificate from file '%s': %m",
+ arg_cert ?: CERT_FILE);
if (arg_trust_all)
log_info("Certificate checking disabled.");
else {
r = read_full_file(arg_trust ?: TRUST_FILE, trust, NULL);
- if (r < 0) {
- log_error_errno(r, "Failed to read CA certificate file '%s': %m",
- arg_trust ?: TRUST_FILE);
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to read CA certificate file '%s': %m",
+ arg_trust ?: TRUST_FILE);
}
return 0;
diff --git a/src/journal-remote/journal-upload-journal.c b/src/journal-remote/journal-upload-journal.c
index 6e5e45f7c9..942320cbf6 100644
--- a/src/journal-remote/journal-upload-journal.c
+++ b/src/journal-remote/journal-upload-journal.c
@@ -25,10 +25,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
u->current_cursor = NULL;
r = sd_journal_get_cursor(u->journal, &u->current_cursor);
- if (r < 0) {
- log_error_errno(r, "Failed to get cursor: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to get cursor: %m");
r = snprintf(buf + pos, size - pos,
"__CURSOR=%s\n", u->current_cursor);
@@ -51,10 +49,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
usec_t realtime;
r = sd_journal_get_realtime_usec(u->journal, &realtime);
- if (r < 0) {
- log_error_errno(r, "Failed to get realtime timestamp: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to get realtime timestamp: %m");
r = snprintf(buf + pos, size - pos,
"__REALTIME_TIMESTAMP="USEC_FMT"\n", realtime);
@@ -78,10 +74,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
sd_id128_t boot_id;
r = sd_journal_get_monotonic_usec(u->journal, &monotonic, &boot_id);
- if (r < 0) {
- log_error_errno(r, "Failed to get monotonic timestamp: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to get monotonic timestamp: %m");
r = snprintf(buf + pos, size - pos,
"__MONOTONIC_TIMESTAMP="USEC_FMT"\n", monotonic);
@@ -105,10 +99,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
char sid[33];
r = sd_journal_get_monotonic_usec(u->journal, NULL, &boot_id);
- if (r < 0) {
- log_error_errno(r, "Failed to get monotonic timestamp: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to get monotonic timestamp: %m");
r = snprintf(buf + pos, size - pos,
"_BOOT_ID=%s\n", sd_id128_to_string(boot_id, sid));
@@ -133,10 +125,9 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
r = sd_journal_enumerate_data(u->journal,
&u->field_data,
&u->field_length);
- if (r < 0) {
- log_error_errno(r, "Failed to move to next field in entry: %m");
- return r;
- } else if (r == 0) {
+ if (r < 0)
+ return log_error_errno(r, "Failed to move to next field in entry: %m");
+ else if (r == 0) {
u->entry_state = ENTRY_OUTRO;
continue;
}
@@ -302,10 +293,9 @@ static int process_journal_input(Uploader *u, int skip) {
int r;
r = sd_journal_next_skip(u->journal, skip);
- if (r < 0) {
- log_error_errno(r, "Failed to skip to next entry: %m");
- return r;
- } else if (r < skip)
+ if (r < 0)
+ return log_error_errno(r, "Failed to skip to next entry: %m");
+ else if (r < skip)
return 0;
/* have data */
@@ -361,10 +351,8 @@ int open_journal_for_upload(Uploader *u,
if (follow) {
fd = sd_journal_get_fd(j);
- if (fd < 0) {
- log_error_errno(fd, "sd_journal_get_fd failed: %m");
- return fd;
- }
+ if (fd < 0)
+ return log_error_errno(fd, "sd_journal_get_fd failed: %m");
events = sd_journal_get_events(j);
@@ -377,10 +365,8 @@ int open_journal_for_upload(Uploader *u,
r = sd_event_add_io(u->events, &u->input_event,
fd, events, dispatch_journal_input, u);
- if (r < 0) {
- log_error_errno(r, "Failed to register input event: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to register input event: %m");
log_debug("Listening for journal events on fd:%d, timeout %d",
fd, u->timeout == (uint64_t) -1 ? -1 : (int) u->timeout);
@@ -390,9 +376,8 @@ int open_journal_for_upload(Uploader *u,
if (cursor) {
r = sd_journal_seek_cursor(j, cursor);
if (r < 0) {
- log_error_errno(r, "Failed to seek to cursor %s: %m",
- cursor);
- return r;
+ return log_error_errno(r, "Failed to seek to cursor %s: %m",
+ cursor);
}
}
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c
index e677e13348..8da65132ca 100644
--- a/src/journal-remote/journal-upload.c
+++ b/src/journal-remote/journal-upload.c
@@ -103,18 +103,14 @@ static int check_cursor_updating(Uploader *u) {
return 0;
r = mkdir_parents(u->state_file, 0755);
- if (r < 0) {
- log_error_errno(r, "Cannot create parent directory of state file %s: %m",
- u->state_file);
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Cannot create parent directory of state file %s: %m",
+ u->state_file);
r = fopen_temporary(u->state_file, &f, &temp_path);
- if (r < 0) {
- log_error_errno(r, "Cannot save state to %s: %m",
- u->state_file);
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Cannot save state to %s: %m",
+ u->state_file);
unlink(temp_path);
return 0;
@@ -164,11 +160,10 @@ static int load_cursor_state(Uploader *u) {
if (r == -ENOENT)
log_debug("State file %s is not present.", u->state_file);
- else if (r < 0) {
- log_error_errno(r, "Failed to read state file %s: %m",
- u->state_file);
- return r;
- } else
+ else if (r < 0)
+ return log_error_errno(r, "Failed to read state file %s: %m",
+ u->state_file);
+ else
log_debug("Last cursor was %s", u->last_cursor);
return 0;
@@ -374,10 +369,8 @@ static int open_file_for_upload(Uploader *u, const char *filename) {
r = sd_event_add_io(u->events, &u->input_event,
fd, EPOLLIN, dispatch_fd_input, u);
if (r < 0) {
- if (r != -EPERM || arg_follow > 0) {
- log_error_errno(r, "Failed to register input event: %m");
- return r;
- }
+ if (r != -EPERM || arg_follow > 0)
+ return log_error_errno(r, "Failed to register input event: %m");
/* Normal files should just be consumed without polling. */
r = start_upload(u, fd_input_callback, u);
@@ -458,16 +451,12 @@ static int setup_uploader(Uploader *u, const char *url, const char *state_file)
u->state_file = state_file;
r = sd_event_default(&u->events);
- if (r < 0) {
- log_error_errno(r, "sd_event_default failed: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "sd_event_default failed: %m");
r = setup_signals(u);
- if (r < 0) {
- log_error_errno(r, "Failed to set up signals: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to set up signals: %m");
return load_cursor_state(u);
}
@@ -701,10 +690,8 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_FILE:
r = glob_extend(&arg_file, optarg);
- if (r < 0) {
- log_error_errno(r, "Failed to add paths: %m");
- return r;
- };
+ if (r < 0)
+ return log_error_errno(r, "Failed to add paths: %m");
break;
case ARG_CURSOR:
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
index 67bf4ba017..03dddb48a5 100644
--- a/src/journal/catalog.c
+++ b/src/journal/catalog.c
@@ -341,17 +341,13 @@ static long write_catalog(const char *database, Hashmap *h, struct strbuf *sb,
return log_oom();
r = mkdir_p(d, 0775);
- if (r < 0) {
- log_error_errno(r, "Recursive mkdir %s: %m", d);
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Recursive mkdir %s: %m", d);
r = fopen_temporary(database, &w, &p);
- if (r < 0) {
- log_error_errno(r, "Failed to open database for writing: %s: %m",
- database);
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to open database for writing: %s: %m",
+ database);
zero(header);
memcpy(header.signature, CATALOG_SIGNATURE, sizeof(header.signature));
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index e971ab360d..bcb2a4b1e2 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -332,10 +332,8 @@ static int kbdctx_refresh_keymap(kbdctx *kc) {
/* TODO: add a fallback keymap that's compiled-in */
r = kbdmap_new_from_names(&km, kc, kc->last_x11_model, kc->last_x11_layout,
kc->last_x11_variant, kc->last_x11_options);
- if (r < 0) {
- log_debug_errno(r, "idev-keyboard: cannot create keymap from locale1: %m");
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "idev-keyboard: cannot create keymap from locale1: %m");
kbdmap_unref(kc->kbdmap);
kc->kbdmap = km;
@@ -1161,9 +1159,8 @@ static int keyboard_update_kbdtbl(idev_keyboard *k) {
return 0;
error:
- log_debug_errno(r, "idev-keyboard: %s/%s: cannot adopt new compose table: %m",
- d->session->name, d->name);
- return r;
+ return log_debug_errno(r, "idev-keyboard: %s/%s: cannot adopt new compose table: %m",
+ d->session->name, d->name);
}
static const idev_device_vtable keyboard_vtable = {
diff --git a/src/libsystemd-terminal/sysview.c b/src/libsystemd-terminal/sysview.c
index 62d9b66060..9ee32db1bc 100644
--- a/src/libsystemd-terminal/sysview.c
+++ b/src/libsystemd-terminal/sysview.c
@@ -975,11 +975,9 @@ static int context_ud_hotplug(sysview_context *c, struct udev_device *d) {
return 0;
r = device_new_ud(&device, seat, type, d);
- if (r < 0) {
- log_debug_errno(r, "sysview: cannot create device for udev-device '%s': %m",
- syspath);
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "sysview: cannot create device for udev-device '%s': %m",
+ syspath);
context_add_device(c, device);
}
@@ -1102,10 +1100,8 @@ static int context_ld_seat_new(sysview_context *c, sd_bus_message *signal) {
int r;
r = sd_bus_message_read(signal, "so", &id, &path);
- if (r < 0) {
- log_debug_errno(r, "sysview: cannot parse SeatNew from logind: %m");
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "sysview: cannot parse SeatNew from logind: %m");
context_add_seat(c, id);
return 0;
@@ -1117,10 +1113,8 @@ static int context_ld_seat_removed(sysview_context *c, sd_bus_message *signal) {
int r;
r = sd_bus_message_read(signal, "so", &id, &path);
- if (r < 0) {
- log_debug_errno(r, "sysview: cannot parse SeatRemoved from logind: %m");
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "sysview: cannot parse SeatRemoved from logind: %m");
seat = sysview_find_seat(c, id);
if (!seat)
@@ -1138,10 +1132,8 @@ static int context_ld_session_new(sysview_context *c, sd_bus_message *signal) {
int r;
r = sd_bus_message_read(signal, "so", &id, &path);
- if (r < 0) {
- log_debug_errno(r, "sysview: cannot parse SessionNew from logind: %m");
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "sysview: cannot parse SessionNew from logind: %m");
/*
* As the dbus message didn't contain enough information, we
@@ -1182,9 +1174,8 @@ static int context_ld_session_new(sysview_context *c, sd_bus_message *signal) {
return 0;
error:
- log_debug_errno(r, "sysview: failed retrieving information for new session '%s': %m",
- id);
- return r;
+ return log_debug_errno(r, "sysview: failed retrieving information for new session '%s': %m",
+ id);
}
static int context_ld_session_removed(sysview_context *c, sd_bus_message *signal) {
@@ -1193,10 +1184,8 @@ static int context_ld_session_removed(sysview_context *c, sd_bus_message *signal
int r;
r = sd_bus_message_read(signal, "so", &id, &path);
- if (r < 0) {
- log_debug_errno(r, "sysview: cannot parse SessionRemoved from logind: %m");
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "sysview: cannot parse SessionRemoved from logind: %m");
session = sysview_find_session(c, id);
if (!session)
@@ -1295,8 +1284,7 @@ static int context_ld_list_seats_fn(sd_bus *bus,
return 0;
error:
- log_debug_errno(r, "sysview: erroneous ListSeats response from logind: %m");
- return r;
+ return log_debug_errno(r, "sysview: erroneous ListSeats response from logind: %m");
}
static int context_ld_list_sessions_fn(sd_bus *bus,
@@ -1360,8 +1348,7 @@ static int context_ld_list_sessions_fn(sd_bus *bus,
return 0;
error:
- log_debug_errno(r, "sysview: erroneous ListSessions response from logind: %m");
- return r;
+ return log_debug_errno(r, "sysview: erroneous ListSessions response from logind: %m");
}
static int context_ld_scan(sysview_context *c) {
@@ -1491,19 +1478,15 @@ static int context_scan_fn(sd_event_source *s, void *userdata) {
if (!c->scanned) {
r = context_ld_scan(c);
- if (r < 0) {
- log_debug_errno(r, "sysview: logind scan failed: %m");
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "sysview: logind scan failed: %m");
}
/* skip device scans if no sessions are available */
if (hashmap_size(c->session_map) > 0) {
r = context_ud_scan(c);
- if (r < 0) {
- log_debug_errno(r, "sysview: udev scan failed: %m");
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "sysview: udev scan failed: %m");
HASHMAP_FOREACH(seat, c->seat_map, i)
seat->scanned = true;
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 9502fa8caa..a85e8fa21e 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -117,31 +117,23 @@ int address_drop(Address *address, Link *link,
r = sd_rtnl_message_new_addr(link->manager->rtnl, &req, RTM_DELADDR,
link->ifindex, address->family);
- if (r < 0) {
- log_error_errno(r, "Could not allocate RTM_DELADDR message: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not allocate RTM_DELADDR message: %m");
r = sd_rtnl_message_addr_set_prefixlen(req, address->prefixlen);
- if (r < 0) {
- log_error_errno(r, "Could not set prefixlen: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not set prefixlen: %m");
if (address->family == AF_INET)
r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
else if (address->family == AF_INET6)
r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
- if (r < 0) {
- log_error_errno(r, "Could not send rtnetlink message: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not send rtnetlink message: %m");
link_ref(link);
@@ -161,65 +153,47 @@ int address_update(Address *address, Link *link,
r = sd_rtnl_message_new_addr_update(link->manager->rtnl, &req,
link->ifindex, address->family);
- if (r < 0) {
- log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
r = sd_rtnl_message_addr_set_prefixlen(req, address->prefixlen);
- if (r < 0) {
- log_error_errno(r, "Could not set prefixlen: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not set prefixlen: %m");
r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT);
- if (r < 0) {
- log_error_errno(r, "Could not set flags: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not set flags: %m");
r = sd_rtnl_message_addr_set_scope(req, address->scope);
- if (r < 0) {
- log_error_errno(r, "Could not set scope: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not set scope: %m");
if (address->family == AF_INET)
r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
else if (address->family == AF_INET6)
r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
if (address->family == AF_INET) {
r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
}
if (address->label) {
r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
}
r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO, &address->cinfo);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
- if (r < 0) {
- log_error_errno(r, "Could not send rtnetlink message: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not send rtnetlink message: %m");
link_ref(link);
@@ -305,77 +279,57 @@ int address_configure(Address *address, Link *link,
r = sd_rtnl_message_new_addr(link->manager->rtnl, &req, RTM_NEWADDR,
link->ifindex, address->family);
- if (r < 0) {
- log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
r = sd_rtnl_message_addr_set_prefixlen(req, address->prefixlen);
- if (r < 0) {
- log_error_errno(r, "Could not set prefixlen: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not set prefixlen: %m");
r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT);
- if (r < 0) {
- log_error_errno(r, "Could not set flags: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not set flags: %m");
r = sd_rtnl_message_addr_set_scope(req, address->scope);
- if (r < 0) {
- log_error_errno(r, "Could not set scope: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not set scope: %m");
if (address->family == AF_INET)
r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
else if (address->family == AF_INET6)
r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
if (!in_addr_is_null(address->family, &address->in_addr_peer)) {
if (address->family == AF_INET)
r = sd_rtnl_message_append_in_addr(req, IFA_ADDRESS, &address->in_addr_peer.in);
else if (address->family == AF_INET6)
r = sd_rtnl_message_append_in6_addr(req, IFA_ADDRESS, &address->in_addr_peer.in6);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_ADDRESS attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_ADDRESS attribute: %m");
} else {
if (address->family == AF_INET) {
r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
}
}
if (address->label) {
r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
}
r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO,
&address->cinfo);
- if (r < 0) {
- log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
- if (r < 0) {
- log_error_errno(r, "Could not send rtnetlink message: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not send rtnetlink message: %m");
link_ref(link);