[git commit] sysctl: allow setting empty values

Denys Vlasenko vda.linux at googlemail.com
Fri Feb 8 13:02:59 UTC 2019


commit: https://git.busybox.net/busybox/commit/?id=317498f3b3335ee9b9944929ffae16f07e1ebd2d
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
sysctl_act_on_setting                                451     445      -6

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 procps/sysctl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/procps/sysctl.c b/procps/sysctl.c
index 5fa7646d1..42de374d2 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -119,14 +119,16 @@ static int sysctl_act_on_setting(char *setting)
 	if (cptr)
 		writing = 1;
 	if (writing) {
-		if (cptr == NULL) {
+		if (!cptr) {
 			bb_error_msg("error: '%s' must be of the form name=value",
 				outname);
 			retval = EXIT_FAILURE;
 			goto end;
 		}
 		value = cptr + 1;  /* point to the value in name=value */
-		if (setting == cptr || !*value) {
+		if (setting == cptr /* "name" can't be empty */
+		 /* || !*value - WRONG: "sysctl net.ipv4.ip_local_reserved_ports=" is a valid syntax (clears the value) */
+		) {
 			bb_error_msg("error: malformed setting '%s'", outname);
 			retval = EXIT_FAILURE;
 			goto end;


More information about the busybox-cvs mailing list