From: Karel Zak Date: Thu, 26 Sep 2013 07:45:22 +0000 (+0200) Subject: libmount: make mnt_fs_{ap,pre}pend_options() more robust X-Git-Tag: v2.24-rc1~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e670193db20e9fe9b57cab90166c732a41b6117;p=thirdparty%2Futil-linux.git libmount: make mnt_fs_{ap,pre}pend_options() more robust We should not use the results from mnt_split_optstr() if the function failed. Signed-off-by: Karel Zak --- diff --git a/libmount/src/fs.c b/libmount/src/fs.c index ebdc44fb90..e1bfb7b97e 100644 --- a/libmount/src/fs.c +++ b/libmount/src/fs.c @@ -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)