]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: make mnt_fs_{ap,pre}pend_options() more robust
authorKarel Zak <kzak@redhat.com>
Thu, 26 Sep 2013 07:45:22 +0000 (09:45 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 26 Sep 2013 07:45:22 +0000 (09:45 +0200)
We should not use the results from mnt_split_optstr() if the function
failed.

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/fs.c

index ebdc44fb90b5040ac02643afdb03fee10c722cf3..e1bfb7b97e5badcace75070f015ad5447a955a0a 100644 (file)
@@ -876,6 +876,9 @@ int mnt_fs_append_options(struct libmnt_fs *fs, const char *optstr)
                return 0;
 
        rc = mnt_split_optstr((char *) optstr, &u, &v, &f, 0, 0);
+       if (rc)
+               return rc;
+
        if (!rc && v)
                rc = mnt_optstr_append_option(&fs->vfs_optstr, v, NULL);
        if (!rc && f)
@@ -916,6 +919,9 @@ int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr)
                return 0;
 
        rc = mnt_split_optstr((char *) optstr, &u, &v, &f, 0, 0);
+       if (rc)
+               return rc;
+
        if (!rc && v)
                rc = mnt_optstr_prepend_option(&fs->vfs_optstr, v, NULL);
        if (!rc && f)