mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-24 05:12:29 +02:00
[package] nvram: fix crash when get, set or unset is invoked without argument (#7263)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21288 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
ec79a3d916
commit
a1dcc39e13
@ -8,7 +8,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=nvram
|
PKG_NAME:=nvram
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=6
|
||||||
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
|
@ -165,20 +165,32 @@ int main( int argc, const char *argv[] )
|
|||||||
stat = do_info(nvram);
|
stat = do_info(nvram);
|
||||||
done++;
|
done++;
|
||||||
}
|
}
|
||||||
else if( !strcmp(argv[i], "get") && ++i < argc )
|
else if( !strcmp(argv[i], "get") || !strcmp(argv[i], "unset") || !strcmp(argv[i], "set") )
|
||||||
{
|
{
|
||||||
stat = do_get(nvram, argv[i]);
|
if( (i+1) < argc )
|
||||||
done++;
|
{
|
||||||
}
|
switch(argv[i++][0])
|
||||||
else if( !strcmp(argv[i], "unset") && ++i < argc )
|
{
|
||||||
{
|
case 'g':
|
||||||
stat = do_unset(nvram, argv[i]);
|
stat = do_get(nvram, argv[i]);
|
||||||
done++;
|
break;
|
||||||
}
|
|
||||||
else if( !strcmp(argv[i], "set") && ++i < argc )
|
case 'u':
|
||||||
{
|
stat = do_unset(nvram, argv[i]);
|
||||||
stat = do_set(nvram, argv[i]);
|
break;
|
||||||
done++;
|
|
||||||
|
case 's':
|
||||||
|
stat = do_set(nvram, argv[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
done++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Command '%s' requires an argument!\n", argv[i]);
|
||||||
|
done = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( !strcmp(argv[i], "commit") )
|
else if( !strcmp(argv[i], "commit") )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user