Use < 0 instead of == -1
This commit is contained in:
@@ -11,7 +11,7 @@ apathmax(char **p, long *size)
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
if ((*size = pathconf("/", _PC_PATH_MAX)) == -1) {
|
||||
if ((*size = pathconf("/", _PC_PATH_MAX)) < 0) {
|
||||
if (errno == 0) {
|
||||
*size = BUFSIZ;
|
||||
} else {
|
||||
|
@@ -66,7 +66,7 @@ cp(const char *s1, const char *s2)
|
||||
if (!(dp = opendir(s1)))
|
||||
eprintf("opendir %s:", s1);
|
||||
|
||||
if (mkdir(s2, st.st_mode) == -1 && errno != EEXIST)
|
||||
if (mkdir(s2, st.st_mode) < 0 && errno != EEXIST)
|
||||
eprintf("mkdir %s:", s2);
|
||||
|
||||
apathmax(&ns1, &size1);
|
||||
@@ -144,7 +144,7 @@ preserve:
|
||||
r = lchown(s2, st.st_uid, st.st_gid);
|
||||
else
|
||||
r = chown(s2, st.st_uid, st.st_gid);
|
||||
if (r == -1) {
|
||||
if (r < 0) {
|
||||
weprintf("cp: can't preserve ownership of '%s':", s2);
|
||||
cp_status = 1;
|
||||
}
|
||||
|
@@ -8,13 +8,13 @@ fnck(const char *a, const char *b, int (*fn)(const char *, const char *))
|
||||
{
|
||||
struct stat sta, stb;
|
||||
|
||||
if (stat(a, &sta) == 0
|
||||
&& stat(b, &stb) == 0
|
||||
&& sta.st_dev == stb.st_dev
|
||||
&& sta.st_ino == stb.st_ino) {
|
||||
if (!stat(a, &sta)
|
||||
&& !stat(b, &stb)
|
||||
&& sta.st_dev == stb.st_dev
|
||||
&& sta.st_ino == stb.st_ino) {
|
||||
eprintf("%s -> %s: same file\n", a, b);
|
||||
}
|
||||
|
||||
if (fn(a, b) == -1)
|
||||
if (fn(a, b) < 0)
|
||||
eprintf("%s -> %s:", a, b);
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ recurse(const char *path, void (*fn)(const char *))
|
||||
struct stat st;
|
||||
DIR *dp;
|
||||
|
||||
if (lstat(path, &st) == -1 || S_ISDIR(st.st_mode) == 0)
|
||||
if (lstat(path, &st) < 0 || !S_ISDIR(st.st_mode))
|
||||
return;
|
||||
|
||||
if (!(dp = opendir(path)))
|
||||
|
@@ -12,6 +12,6 @@ rm(const char *path)
|
||||
{
|
||||
if (rm_rflag)
|
||||
recurse(path, rm);
|
||||
if (remove(path) == -1 && !rm_fflag)
|
||||
if (remove(path) < 0 && !rm_fflag)
|
||||
eprintf("remove %s:", path);
|
||||
}
|
||||
|
Reference in New Issue
Block a user