From 1e670193db20e9fe9b57cab90166c732a41b6117 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 26 Sep 2013 09:45:22 +0200 Subject: 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 --- libmount/src/fs.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libmount/src/fs.c') diff --git a/libmount/src/fs.c b/libmount/src/fs.c index ebdc44fb9..e1bfb7b97 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) -- cgit v1.2.3-55-g7522