summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Src/compat.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Src/compat.c b/Src/compat.c
index b8e1a6f0f..1265e7ee9 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -38,7 +38,7 @@ char *
 strstr(const char *s, const char *t)
 {
     char *p1, *p2;
- 
+
     for (; *s; s++) {
         for (p1 = s, p2 = t; *p2; p1++, p2++)
             if (*p1 != *p2)
@@ -387,8 +387,7 @@ zchdir(char *dir)
     int currdir = -2;
 
     for (;;) {
-	if (!*dir || !chdir(dir))
-	{
+	if (!*dir || chdir(dir) == 0) {
 #ifdef HAVE_FCHDIR
            if (currdir >= 0)
                close(currdir);
@@ -398,7 +397,8 @@ zchdir(char *dir)
 	if ((errno != ENAMETOOLONG && errno != ENOMEM) ||
 	    strlen(dir) < PATH_MAX)
 	    break;
-	for (s = dir + PATH_MAX - 1; s > dir && *s != '/'; s--);
+	for (s = dir + PATH_MAX - 1; s > dir && *s != '/'; s--)
+	    ;
 	if (s == dir)
 	    break;
 #ifdef HAVE_FCHDIR
@@ -406,7 +406,7 @@ zchdir(char *dir)
 	    currdir = open(".", O_RDONLY|O_NOCTTY);
 #endif
 	*s = '\0';
-	if (chdir(dir)) {
+	if (chdir(dir) < 0) {
 	    *s = '/';
 	    break;
 	}
@@ -414,7 +414,8 @@ zchdir(char *dir)
 	currdir = -1;
 #endif
 	*s = '/';
-	while (*++s == '/');
+	while (*++s == '/')
+	    ;
 	dir = s;
     }
 #ifdef HAVE_FCHDIR