]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fileio: return 0 from read_one_line_file on success 6891/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 24 Sep 2017 12:27:21 +0000 (14:27 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 24 Sep 2017 12:27:21 +0000 (14:27 +0200)
Fixup for f4b51a2d09. Suggested by Evgeny Vereshchagin.

src/basic/fileio.c

index ae5536a6357cc45c06e3c21e36ed22b89554c0da..d632a6e7146a62ec2b741e03a2ce88bd01622901 100644 (file)
@@ -178,6 +178,7 @@ fail:
 
 int read_one_line_file(const char *fn, char **line) {
         _cleanup_fclose_ FILE *f = NULL;
+        int r;
 
         assert(fn);
         assert(line);
@@ -186,7 +187,8 @@ int read_one_line_file(const char *fn, char **line) {
         if (!f)
                 return -errno;
 
-        return read_line(f, LONG_LINE_MAX, line);
+        r = read_line(f, LONG_LINE_MAX, line);
+        return r < 0 ? r : 0;
 }
 
 int verify_file(const char *fn, const char *blob, bool accept_extra_nl) {