From 0fe40b4677a954bc7b4c843479f216bf1e2e9b3f Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Thu, 17 Dec 2020 10:32:55 +0100 Subject: [PATCH 1/1] Check the chdir() return code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ... to fix the compiler warning: jcc.c: In function ‘main’: jcc.c:5185:7: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result [-Wunused-result] chdir("/"); ^~~~~~~~~~ --- jcc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jcc.c b/jcc.c index 8d99b1f9..d8e25d5b 100644 --- a/jcc.c +++ b/jcc.c @@ -5182,7 +5182,10 @@ int main(int argc, char **argv) } #endif - chdir("/"); + if (chdir("/") != 0) + { + log_error(LOG_LEVEL_FATAL, "Failed to cd into '/': %E"); + } } /* -END- if (daemon_mode) */ -- 2.39.2