[PATCH 2/3] sysctl: abort reading on NULL keys
Jeremy Kerr
jk at ozlabs.org
Wed Nov 28 03:11:24 UTC 2007
At present, sysctl_read_setting() detects NULL keys, but keeps
processing regardless.
This change aborts the read on NULL keys.
Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
--
bloat-o-meter results on powerpc:
function old new delta
sysctl_read_setting 460 468 +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 8/0) Total: 8 bytes
---
procps/sysctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: busybox/procps/sysctl.c
===================================================================
--- busybox.orig/procps/sysctl.c
+++ busybox/procps/sysctl.c
@@ -249,8 +249,10 @@ static int sysctl_read_setting(const cha
const char *name;
FILE *fp;
- if (!*setting)
+ if (!*setting) {
bb_error_msg(ERR_INVALID_KEY, setting);
+ return -1;
+ }
name = setting;
tmpname = concat_path_file(PROC_SYS, name);
More information about the busybox
mailing list