From bb78896c7ffb23546dca127e324f33e4ba753669 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 1 Dec 2004 18:18:23 +0000 Subject: A few minor style tweaks (as discussed in 20595 and 20596). --- Src/compat.c | 13 +++++++------ 1 file 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 -- cgit 1.4.1