diff options
author | Jo-Philipp Wich <jo@mein.io> | 2016-06-11 00:51:22 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2016-06-11 00:51:22 +0200 |
commit | dd182011e1acabc94169b85f3bc63efbab72ddd4 (patch) | |
tree | 6654fba853fa3c2e8b9b04e49fdc71877e296c27 /package/network/config/swconfig/src | |
parent | e8150364608e38e6b30ea0859ffa17ccb1fcc890 (diff) | |
download | upstream-dd182011e1acabc94169b85f3bc63efbab72ddd4.tar.gz upstream-dd182011e1acabc94169b85f3bc63efbab72ddd4.tar.bz2 upstream-dd182011e1acabc94169b85f3bc63efbab72ddd4.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>
Diffstat (limited to 'package/network/config/swconfig/src')
-rw-r--r-- | package/network/config/swconfig/src/cli.c | 12 |
1 files changed, 6 insertions, 6 deletions
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); |