summaryrefslogtreecommitdiff
path: root/src/network/networkctl.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/network/networkctl.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/network/networkctl.c')
-rw-r--r--src/network/networkctl.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 2754ed8d3e..035dce162b 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -190,10 +190,8 @@ static int list_links(char **args, unsigned n) {
pager_open_if_enabled();
r = sd_rtnl_open(&rtnl, 0);
- if (r < 0) {
- log_error_errno(r, "Failed to connect to netlink: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to connect to netlink: %m");
udev = udev_new();
if (!udev) {
@@ -210,10 +208,8 @@ static int list_links(char **args, unsigned n) {
return rtnl_log_create_error(r);
r = sd_rtnl_call(rtnl, req, 0, &reply);
- if (r < 0) {
- log_error_errno(r, "Failed to enumerate links: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to enumerate links: %m");
if (arg_legend)
printf("%3s %-16s %-18s %-11s %-10s\n", "IDX", "LINK", "TYPE", "OPERATIONAL", "SETUP");
@@ -322,10 +318,8 @@ static int link_status_one(sd_rtnl *rtnl, struct udev *udev, const char *name) {
return rtnl_log_create_error(r);
r = sd_rtnl_call(rtnl, req, 0, &reply);
- if (r < 0) {
- log_error_errno(r, "Failed to query link: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to query link: %m");
r = sd_rtnl_message_link_get_ifindex(reply, &ifindex);
if (r < 0)
@@ -447,10 +441,8 @@ static int link_status(char **args, unsigned n) {
int r;
r = sd_rtnl_open(&rtnl, 0);
- if (r < 0) {
- log_error_errno(r, "Failed to connect to netlink: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to connect to netlink: %m");
udev = udev_new();
if (!udev) {
@@ -513,10 +505,8 @@ static int link_status(char **args, unsigned n) {
return rtnl_log_create_error(r);
r = sd_rtnl_call(rtnl, req, 0, &reply);
- if (r < 0) {
- log_error_errno(r, "Failed to enumerate links: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to enumerate links: %m");
c = decode_and_sort_links(reply, &links);
if (c < 0)