]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: initialize return value of parse_config_stream to success
authorEric Sandeen <sandeen@redhat.com>
Fri, 15 Jun 2018 02:22:52 +0000 (21:22 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 15 Jun 2018 02:22:52 +0000 (21:22 -0500)
Right now the return value is initialized to -1 (failure) and set to zero
only if a valid token is found.  However, this means that i.e. a blank
or template config file containing only comments will yield failure on
parsing.

Initialize to success, and set to failure only if failure occurs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@kernel.org>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
mkfs/config.c

index 835adc45f02d02527bdb039f240a3697e6ca5286..1a2cd353c8962c1e54d25b2f9d10ecfdfacbe6ae 100644 (file)
@@ -385,7 +385,7 @@ parse_config_stream(
        const char                      *config_file,
        FILE                            *fp)
 {
-       int                             ret = -1;
+       int                             ret = 0;
        char                            *line = NULL;
        ssize_t                         linelen;
        size_t                          len = 0, lineno = 0;