diff options
author | Karel Zak | 2013-09-26 09:45:22 +0200 |
---|---|---|
committer | Karel Zak | 2013-09-26 09:45:22 +0200 |
commit | 1e670193db20e9fe9b57cab90166c732a41b6117 (patch) | |
tree | 29571aaf921d3afc5305ce31210af77125c93d80 /libmount/src/fs.c | |
parent | libmount: Remove stale comment on mnt_context_mount() (diff) | |
download | kernel-qcow2-util-linux-1e670193db20e9fe9b57cab90166c732a41b6117.tar.gz kernel-qcow2-util-linux-1e670193db20e9fe9b57cab90166c732a41b6117.tar.xz kernel-qcow2-util-linux-1e670193db20e9fe9b57cab90166c732a41b6117.zip |
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 <kzak@redhat.com>
Diffstat (limited to 'libmount/src/fs.c')
-rw-r--r-- | libmount/src/fs.c | 6 |
1 files changed, 6 insertions, 0 deletions
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) |