Hi all,
Use xasprintf instead of sprintf
function old new delta
rfkill_main 756 714 -42
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-42) Total: -42
bytes
Thanks.
--- busybox/include/applets.src.h.orig 2013-11-16 13:26:52.324522977 +0100
+++ busybox/include/applets.src.h 2013-11-16 13:27:26.076522297 +0100
@@ -304,7 +304,6 @@
IF_RESET(APPLET(reset, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_RESIZE(APPLET(resize, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon))
-IF_RFKILL(APPLET(rfkill, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_RM(APPLET_NOFORK(rm, rm, BB_DIR_BIN, BB_SUID_DROP, rm))
IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, BB_DIR_BIN, BB_SUID_DROP, rmdir))
IF_ROUTE(APPLET(route, BB_DIR_SBIN, BB_SUID_DROP))
--- busybox/miscutils/Config.src.orig 2013-11-16 13:28:23.112521148 +0100
+++ busybox/miscutils/Config.src 2013-11-16 13:28:39.456520819 +0100
@@ -503,18 +503,6 @@
As readahead(2) blocks until each file has been read, it is best to
run this applet as a background job.
-config RFKILL
- bool "rfkill"
- default n # doesn't build on Ubuntu 9.04
- select PLATFORM_LINUX
- help
- Enable/disable wireless devices.
-
- rfkill list : list all wireless devices
- rfkill list bluetooth : list all bluetooth devices
- rfkill list 1 : list device corresponding to the given index
- rfkill block|unblock wlan : block/unblock all wlan(wifi) devices
-
config RUNLEVEL
bool "runlevel"
default y
--- busybox/miscutils/Kbuild.src.orig 2013-11-16 13:28:51.560520575 +0100
+++ busybox/miscutils/Kbuild.src 2013-11-16 13:29:14.020520123 +0100
@@ -36,7 +36,6 @@
lib-$(CONFIG_MT) += mt.o
lib-$(CONFIG_RAIDAUTORUN) += raidautorun.o
lib-$(CONFIG_READAHEAD) += readahead.o
-lib-$(CONFIG_RFKILL) += rfkill.o
lib-$(CONFIG_RUNLEVEL) += runlevel.o
lib-$(CONFIG_RX) += rx.o
lib-$(CONFIG_SETSID) += setsid.o
--- busybox/miscutils/rfkill.c.orig 2013-11-16 12:51:44.964565423 +0100
+++ busybox/miscutils/rfkill.c 2013-11-16 13:45:53.332499995 +0100
@@ -7,6 +7,23 @@
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config RFKILL
+//config: bool "rfkill"
+//config: default n # doesn't build on Ubuntu 9.04
+//config: select PLATFORM_LINUX
+//config: help
+//config: Enable/disable wireless devices.
+//config:
+//config: rfkill list : list all wireless devices
+//config: rfkill list bluetooth : list all bluetooth devices
+//config: rfkill list 1 : list device corresponding to the given index
+//config: rfkill block|unblock wlan : block/unblock all wlan(wifi) devices
+//config:
+
+//applet:IF_RFKILL(APPLET(rfkill, BB_DIR_USR_SBIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_RFKILL) += rfkill.o
+
//usage:#define rfkill_trivial_usage
//usage: "COMMAND [INDEX|TYPE]"
//usage:#define rfkill_full_usage "\n\n"
@@ -78,7 +95,7 @@
while (full_read(rf_fd, &event, sizeof(event)) == RFKILL_EVENT_SIZE_V1) {
parser_t *parser;
char *tokens[2];
- char rf_sysfs[sizeof("/sys/class/rfkill/rfkill%u/uevent") + sizeof(int)*3];
+ char *rf_sysfs;
char *name, *type;
if (rf_type && rf_type != event.type && rf_idx < 0) {
@@ -91,8 +108,9 @@
name = NULL;
type = NULL;
- sprintf(rf_sysfs, "/sys/class/rfkill/rfkill%u/uevent", event.idx);
+ rf_sysfs = xasprintf("/sys/class/rfkill/rfkill%u/uevent", event.idx);
parser = config_open2(rf_sysfs, fopen_for_read);
+ free(rf_sysfs);
while (config_read(parser, tokens, 2, 2, "\n=", PARSE_NORMAL)) {
if (strcmp(tokens[0], "RFKILL_NAME") == 0) {
name = xstrdup(tokens[1]);
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox