diff options
author | Jo-Philipp Wich <jo@mein.io> | 2016-07-04 20:45:53 +0200 |
---|---|---|
committer | Zoltan HERPAI <wigyori@uid0.hu> | 2016-07-04 20:45:53 +0200 |
commit | 8207cd3298c926ac66e2aba188c4846d7ed69649 (patch) | |
tree | fed5525214ecfbb068709521a12dbabc1a888c75 | |
parent | c7789efa7f644173f3ff67c2c9c4cf6a66d8ebb8 (diff) | |
download | master-187ad058-8207cd3298c926ac66e2aba188c4846d7ed69649.tar.gz master-187ad058-8207cd3298c926ac66e2aba188c4846d7ed69649.tar.bz2 master-187ad058-8207cd3298c926ac66e2aba188c4846d7ed69649.zip |
swconfig: improve failure reporting
Report the translated error to the user if a get/set netlink operation failed.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | package/network/config/swconfig/Makefile | 2 | ||||
-rw-r--r-- | package/network/config/swconfig/src/cli.c | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/package/network/config/swconfig/Makefile b/package/network/config/swconfig/Makefile index 2856742fcd..f4ba3a9d69 100644 --- a/package/network/config/swconfig/Makefile +++ b/package/network/config/swconfig/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=swconfig -PKG_RELEASE:=10 +PKG_RELEASE:=11 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> PKG_LICENSE:=GPL-2.0 diff --git a/package/network/config/swconfig/src/cli.c b/package/network/config/swconfig/src/cli.c index 331f3d5dac..eab6c64742 100644 --- a/package/network/config/swconfig/src/cli.c +++ b/package/network/config/swconfig/src/cli.c @@ -335,10 +335,10 @@ int main(int argc, char **argv) if(cvlan > -1) cport = cvlan; - if(swlib_set_attr_string(dev, a, cport, cvalue) < 0) + retval = swlib_set_attr_string(dev, a, cport, cvalue); + if (retval < 0) { - fprintf(stderr, "failed\n"); - retval = -1; + nl_perror(-retval, "Failed to set attribute"); goto out; } break; @@ -347,10 +347,10 @@ int main(int argc, char **argv) val.port_vlan = cvlan; if(cport > -1) val.port_vlan = cport; - if(swlib_get_attr(dev, a, &val) < 0) + retval = swlib_get_attr(dev, a, &val); + if (retval < 0) { - fprintf(stderr, "failed\n"); - retval = -1; + nl_perror(-retval, "Failed to get attribute"); goto out; } print_attr_val(a, &val); |