From a8e0e96af3222c42663b3c60158caed20ac46829 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 6 Sep 2017 14:31:42 +0200 Subject: [PATCH] Fix unused-result warning for chdir Fixes this warning: Source/main.cpp: In function 'void chdirToAppPath(const char*)': Source/main.cpp:581:14: warning: ignoring return value of 'int chdir(const char*)', declared with attribute warn_unused_result [-Wunused-result] chdir(dir); ~~~~~^~~~~ --- Source/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/main.cpp b/Source/main.cpp index e0270b6..cacfabd 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -579,7 +579,10 @@ static inline void chdirToAppPath(const char* argv0) *ptr = '\0'; } #endif - chdir(dir); + errno = 0; + if (chdir(dir) != 0) { + printf("Error changing dir to '%s' (%s).\n", dir, strerror(errno)); + } free(dir); } } -- 2.39.5