summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-10-02 21:07:32 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-10-07 14:50:14 +0200
commit12124d2d445878b785160e01ae931973eb1ab4d9 (patch)
tree0106f503c87df73e943174b57e5fdd334cac68e9 /drivers
parent5393e7310d16656f2a84e0df589c54f9ccfbcd59 (diff)
Safer getcwd in DirAccess
Fix [-Wunused-result]
Diffstat (limited to 'drivers')
-rw-r--r--drivers/unix/dir_access_unix.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 48b4369b7e..929e67faa9 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -309,7 +309,7 @@ Error DirAccessUnix::change_dir(String p_dir) {
// prev_dir is the directory we are changing out of
String prev_dir;
char real_current_dir_name[2048];
- getcwd(real_current_dir_name, 2048);
+ ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == NULL, ERR_BUG);
if (prev_dir.parse_utf8(real_current_dir_name))
prev_dir = real_current_dir_name; //no utf8, maybe latin?
@@ -330,7 +330,7 @@ Error DirAccessUnix::change_dir(String p_dir) {
// the directory exists, so set current_dir to try_dir
current_dir = try_dir;
- chdir(prev_dir.utf8().get_data());
+ ERR_FAIL_COND_V(chdir(prev_dir.utf8().get_data()) != 0, ERR_BUG);
return OK;
}
@@ -405,7 +405,7 @@ DirAccessUnix::DirAccessUnix() {
// set current directory to an absolute path of the current directory
char real_current_dir_name[2048];
- getcwd(real_current_dir_name, 2048);
+ ERR_FAIL_COND(getcwd(real_current_dir_name, 2048) == NULL);
if (current_dir.parse_utf8(real_current_dir_name))
current_dir = real_current_dir_name;