From: RĂ©mi Verschelde Date: Wed, 6 Sep 2017 12:31:42 +0000 (+0200) Subject: Fix unused-result warning for chdir X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=a8e0e96af3222c42663b3c60158caed20ac46829;p=lugaru.git 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); ~~~~~^~~~~ --- 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); } }