Use < 0 instead of == -1
This commit is contained in:
4
pwd.c
4
pwd.c
@@ -41,9 +41,9 @@ getpwd(const char *cwd)
|
||||
const char *pwd;
|
||||
struct stat cst, pst;
|
||||
|
||||
if (!(pwd = getenv("PWD")) || pwd[0] != '/' || stat(pwd, &pst) == -1)
|
||||
if (!(pwd = getenv("PWD")) || pwd[0] != '/' || stat(pwd, &pst) < 0)
|
||||
return cwd;
|
||||
if (stat(cwd, &cst) == -1)
|
||||
if (stat(cwd, &cst) < 0)
|
||||
eprintf("stat %s:", cwd);
|
||||
if (pst.st_dev == cst.st_dev && pst.st_ino == cst.st_ino)
|
||||
return pwd;
|
||||
|
Reference in New Issue
Block a user