tree-wide: check if errno is greater then zero

gcc is confused by the common idiom of
  return errno ? -errno : -ESOMETHING
and thinks a positive value may be returned. Replace this condition
with errno > 0 to help gcc and avoid many spurious warnings. I filed
a gcc rfe a long time ago, but it hard to say if it will ever be
implemented [1].

Both conventions were used in the codebase, this change makes things
more consistent. This is a follow up to bcb161b023.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61846
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-01-13 15:09:55 -05:00
parent d9a090b995
commit f5e5c28f42
14 changed files with 21 additions and 21 deletions
+2 -2
View File
@@ -40,7 +40,7 @@ int glob_exists(const char *path) {
if (k == GLOB_NOSPACE)
return -ENOMEM;
if (k != 0)
return errno ? -errno : -EIO;
return errno > 0 ? -errno : -EIO;
return !strv_isempty(g.gl_pathv);
}
@@ -58,7 +58,7 @@ int glob_extend(char ***strv, const char *path) {
if (k == GLOB_NOSPACE)
return -ENOMEM;
if (k != 0)
return errno ? -errno : -EIO;
return errno > 0 ? -errno : -EIO;
if (strv_isempty(g.gl_pathv))
return -ENOENT;