From d6dda317db4fcd7021ad356b6d424295778145ba Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 26 Jan 2021 11:19:10 +0100 Subject: [PATCH] procd: fix compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit [ 37%] Building C object CMakeFiles/procd.dir/state.c.o /projects/procd/state.c: In function ‘state_enter’: /projects/procd/state.c:147:4: error: ignoring return value of ‘chown’, declared with attribute warn_unused_result [-Werror=unused-result] 147 | chown(p->pw_dir, p->pw_uid, p->pw_gid); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [CMakeFiles/procd.dir/build.make:89: CMakeFiles/procd.dir/state.c.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:241: CMakeFiles/procd.dir/all] Error 2 make: *** [Makefile:130: all] Error 2 Signed-off-by: John Crispin --- state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/state.c b/state.c index 44f56c6..fb81248 100644 --- a/state.c +++ b/state.c @@ -142,9 +142,12 @@ static void state_enter(void) set_stdio("console"); p = getpwnam("ubus"); if (p) { + int ret; LOG("- ubus -\n"); mkdir(p->pw_dir, 0755); - chown(p->pw_dir, p->pw_uid, p->pw_gid); + ret = chown(p->pw_dir, p->pw_uid, p->pw_gid); + if (ret) + LOG("- ubus - failed to chown(%s)\n", p->pw_dir); } else { LOG("- ubus (running as root!) -\n"); } -- 2.30.2