]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/fileio.c
tree-wide: check if errno is greater then zero
[thirdparty/systemd.git] / src / basic / fileio.c
index 3a237252b5ffe2e02663a4d3fc476f4bd29e9eaa..5ed5460904b4207d960ac4b11d7e94eca6997a99 100644 (file)
@@ -165,7 +165,7 @@ int read_one_line_file(const char *fn, char **line) {
         if (!fgets(t, sizeof(t), f)) {
 
                 if (ferror(f))
-                        return errno ? -errno : -EIO;
+                        return errno > 0 ? -errno : -EIO;
 
                 t[0] = 0;
         }
@@ -1064,7 +1064,7 @@ int fflush_and_check(FILE *f) {
         fflush(f);
 
         if (ferror(f))
-                return errno ? -errno : -EIO;
+                return errno > 0 ? -errno : -EIO;
 
         return 0;
 }