summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko2020-06-09 15:58:32 +0200
committerDenys Vlasenko2020-06-09 15:58:32 +0200
commit002be6e821eedfa190c5b060e7b61acb306c2a92 (patch)
tree3eb0d206c179a42807947060b666f816cee7cca6 /procps
parentb2ab920716f640cbaaf486512ba177f4e0b597c5 (diff)
downloadbusybox-002be6e821eedfa190c5b060e7b61acb306c2a92.zip
busybox-002be6e821eedfa190c5b060e7b61acb306c2a92.tar.gz
sysctl: do report EACCES errors on write
function old new delta sysctl_act_recursive 165 179 +14 sysctl_act_on_setting 467 471 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 18/0) Total: 18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/sysctl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 6d77185..e16b119 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -169,13 +169,15 @@ static int sysctl_act_on_setting(char *setting)
if (fd < 0) {
switch (errno) {
- case EACCES:
- /* Happens for write-only settings, e.g. net.ipv6.route.flush */
- goto end;
case ENOENT:
if (option_mask32 & FLAG_SHOW_KEY_ERRORS)
bb_error_msg("error: '%s' is an unknown key", outname);
break;
+ case EACCES:
+ /* Happens for write-only settings, e.g. net.ipv6.route.flush */
+ if (!writing)
+ goto end;
+ /* fall through */
default:
bb_perror_msg("error %sing key '%s'",
writing ?
@@ -236,6 +238,7 @@ static int sysctl_act_recursive(const char *path)
int retval = 0;
if (!(option_mask32 & FLAG_WRITE)
+ && !strchr(path, '=') /* do not try to resurse on "var=val" */
&& stat(path, &buf) == 0
&& S_ISDIR(buf.st_mode)
) {