summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sysdep.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 6d24b7fa2b1..dd0062b6f04 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -274,8 +274,8 @@ get_current_dir_name_or_unreachable (void)
sometimes a nicer name, and using it may avoid a fatal error if a
parent directory is searchable but not readable. */
if (pwd
- && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1])))
&& (pwdlen = strlen (pwd)) < bufsize_max
+ && IS_DIRECTORY_SEP (pwd[pwdlen && IS_DEVICE_SEP (pwd[1]) ? 2 : 0])
&& stat (pwd, &pwdstat) == 0
&& stat (".", &dotstat) == 0
&& dotstat.st_ino == pwdstat.st_ino