mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-10 08:01:41 +01:00
Corrected the error-return comment for zchdir() and optimized the
HAVE_FCHDIR error-return code.
This commit is contained in:
parent
d2c67e5e19
commit
8b136c84d2
1 changed files with 8 additions and 9 deletions
11
Src/compat.c
11
Src/compat.c
|
@ -376,7 +376,7 @@ zgetcwd(void)
|
||||||
return zgetdir(NULL);
|
return zgetdir(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* chdir with arbitrary long pathname. Returns 0 on success, 0 on normal *
|
/* chdir with arbitrary long pathname. Returns 0 on success, -1 on normal *
|
||||||
* failure and -2 when chdir failed and the current directory is lost. */
|
* failure and -2 when chdir failed and the current directory is lost. */
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
@ -418,17 +418,16 @@ zchdir(char *dir)
|
||||||
dir = s;
|
dir = s;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_FCHDIR
|
#ifdef HAVE_FCHDIR
|
||||||
if (currdir == -1 || (currdir >= 0 && fchdir(currdir))) {
|
if (currdir >= 0) {
|
||||||
if (currdir >= 0)
|
if (fchdir(currdir) < 0) {
|
||||||
close(currdir);
|
close(currdir);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
if (currdir >= 0)
|
|
||||||
close(currdir);
|
close(currdir);
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
}
|
||||||
return currdir == -2 ? -1 : -2;
|
|
||||||
#endif
|
#endif
|
||||||
|
return currdir == -2 ? -1 : -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue