[B.A.T.M.A.N.] [PATCH 6/9] batctl: Allow to read loglevel as normal user

Sven Eckelmann
2017-01-22T12:21:10Z

The loglevel sysfs file can be read by normal users. Only writing to this
file is restricted. Don't artificially restrict access to this file by
the batctl subcommand.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
sys.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys.c b/sys.c
index 9dcb4f2..ac978bf 100644
--- a/sys.c
+++ b/sys.c
@@ -152,12 +152,12 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv)
}
}

- check_root_or_die("batctl loglevel");
-
path_buff = malloc(PATH_BUFF_LEN);
snprintf(path_buff, PATH_BUFF_LEN, SYS_BATIF_PATH_FMT, mesh_iface);

if (argc != 1) {
+ check_root_or_die("batctl loglevel");
+
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "none") == 0) {
log_level = 0;
--
2.11.0