When an general user without authority sets the system configuration, 0 is returned, but the modification is not successful. It is unreasonable.
Such as, general user didn't have /proc/sys/fs/protected_hardlinks permissions, but run the command 'busybox sysctl fs.protected_symlinks', 0 is returned. Signed-off-by: Yan Zhu <[email protected]> --- procps/sysctl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/procps/sysctl.c b/procps/sysctl.c index 6d77185..dd981f8 100644 --- a/procps/sysctl.c +++ b/procps/sysctl.c @@ -129,6 +129,7 @@ static int sysctl_act_on_setting(char *setting) char *cptr, *outname; char *value = value; /* for compiler */ bool writing = (option_mask32 & FLAG_WRITE); + bool read_all = (option_mask32 & FLAG_SHOW_ALL); outname = xstrdup(setting); @@ -170,6 +171,13 @@ static int sysctl_act_on_setting(char *setting) if (fd < 0) { switch (errno) { case EACCES: + if (!read_all) { + bb_perror_msg("error %sing key '%s'", + writing ? + "sett" : "read", + outname); + break; + } /* Happens for write-only settings, e.g. net.ipv6.route.flush */ goto end; case ENOENT: -- 2.12.3 _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
