diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-02-08 14:02:59 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-02-08 14:02:59 +0100 |
| commit | 317498f3b3335ee9b9944929ffae16f07e1ebd2d (patch) | |
| tree | ab79d5cbe4cf135f3cec00bf9f3f6fce081a57db | |
| parent | df4e3af9f716e0483bd02fd4ab3ad973ffe5b998 (diff) | |
| download | busybox-w32-317498f3b3335ee9b9944929ffae16f07e1ebd2d.tar.gz busybox-w32-317498f3b3335ee9b9944929ffae16f07e1ebd2d.tar.bz2 busybox-w32-317498f3b3335ee9b9944929ffae16f07e1ebd2d.zip | |
sysctl: allow setting empty values
function old new delta
sysctl_act_on_setting 451 445 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | procps/sysctl.c | 6 |
1 files 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) | |||
| 119 | if (cptr) | 119 | if (cptr) |
| 120 | writing = 1; | 120 | writing = 1; |
| 121 | if (writing) { | 121 | if (writing) { |
| 122 | if (cptr == NULL) { | 122 | if (!cptr) { |
| 123 | bb_error_msg("error: '%s' must be of the form name=value", | 123 | bb_error_msg("error: '%s' must be of the form name=value", |
| 124 | outname); | 124 | outname); |
| 125 | retval = EXIT_FAILURE; | 125 | retval = EXIT_FAILURE; |
| 126 | goto end; | 126 | goto end; |
| 127 | } | 127 | } |
| 128 | value = cptr + 1; /* point to the value in name=value */ | 128 | value = cptr + 1; /* point to the value in name=value */ |
| 129 | if (setting == cptr || !*value) { | 129 | if (setting == cptr /* "name" can't be empty */ |
| 130 | /* || !*value - WRONG: "sysctl net.ipv4.ip_local_reserved_ports=" is a valid syntax (clears the value) */ | ||
| 131 | ) { | ||
| 130 | bb_error_msg("error: malformed setting '%s'", outname); | 132 | bb_error_msg("error: malformed setting '%s'", outname); |
| 131 | retval = EXIT_FAILURE; | 133 | retval = EXIT_FAILURE; |
| 132 | goto end; | 134 | goto end; |
