mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
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>
This commit is contained in:
parent
e815036460
commit
dd182011e1
@ -8,7 +8,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=swconfig
|
PKG_NAME:=swconfig
|
||||||
PKG_RELEASE:=10
|
PKG_RELEASE:=11
|
||||||
|
|
||||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||||
PKG_LICENSE:=GPL-2.0
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
@ -335,10 +335,10 @@ int main(int argc, char **argv)
|
|||||||
if(cvlan > -1)
|
if(cvlan > -1)
|
||||||
cport = cvlan;
|
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");
|
nl_perror(-retval, "Failed to set attribute");
|
||||||
retval = -1;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -347,10 +347,10 @@ int main(int argc, char **argv)
|
|||||||
val.port_vlan = cvlan;
|
val.port_vlan = cvlan;
|
||||||
if(cport > -1)
|
if(cport > -1)
|
||||||
val.port_vlan = cport;
|
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");
|
nl_perror(-retval, "Failed to get attribute");
|
||||||
retval = -1;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
print_attr_val(a, &val);
|
print_attr_val(a, &val);
|
||||||
|
Loading…
Reference in New Issue
Block a user