summaryrefslogtreecommitdiffstats
path: root/platform/x11/godot_x11.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-06-17 17:06:13 +0200
committerRémi Verschelde <rverschelde@gmail.com>2019-06-17 17:06:25 +0200
commit40db7b85afa36dc7d462181fc5bd4c6bbaf7f559 (patch)
tree1dc339642d1064bab253dd26a46f0fd4cd2ff237 /platform/x11/godot_x11.cpp
parent1d93b4abef16d0f930ba305fd7948c9e48770a2d (diff)
downloadredot-engine-40db7b85afa36dc7d462181fc5bd4c6bbaf7f559.tar.gz
Linux: Check return value of chdir on cleanup
Some compilers trigger a warning for it if we do not bother checking the return value. Fixes #29849.
Diffstat (limited to 'platform/x11/godot_x11.cpp')
-rw-r--r--platform/x11/godot_x11.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/x11/godot_x11.cpp b/platform/x11/godot_x11.cpp
index 79407cd9dc..9baa4d6dca 100644
--- a/platform/x11/godot_x11.cpp
+++ b/platform/x11/godot_x11.cpp
@@ -55,8 +55,11 @@ int main(int argc, char *argv[]) {
os.run(); // it is actually the OS that decides how to run
Main::cleanup();
- if (ret)
- chdir(cwd);
+ if (ret) { // Previous getcwd was successful
+ if (chdir(cwd) != 0) {
+ ERR_PRINT("Couldn't return to previous working directory.");
+ }
+ }
free(cwd);
return os.get_exit_code();