summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/optstr.c
diff options
context:
space:
mode:
authorKarel Zak2011-01-25 01:11:37 +0100
committerKarel Zak2011-01-25 01:11:37 +0100
commit5a669b12f84f85f7ace13712b20ce9592a08f157 (patch)
treee0d1db464c5b7c72f9b0c637b883c2fcadecf442 /shlibs/mount/src/optstr.c
parentlibmount: improve status check, minor cleanups (diff)
downloadkernel-qcow2-util-linux-5a669b12f84f85f7ace13712b20ce9592a08f157.tar.gz
kernel-qcow2-util-linux-5a669b12f84f85f7ace13712b20ce9592a08f157.tar.xz
kernel-qcow2-util-linux-5a669b12f84f85f7ace13712b20ce9592a08f157.zip
libmount: fix user= usage
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/optstr.c')
-rw-r--r--shlibs/mount/src/optstr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c
index 9c8aa62e6..fd4a8610c 100644
--- a/shlibs/mount/src/optstr.c
+++ b/shlibs/mount/src/optstr.c
@@ -945,12 +945,13 @@ int mnt_optstr_fix_user(char **optstr)
if (!username)
return -ENOMEM;
- if (!ol.valsz || strncmp(ol.value, username, ol.valsz)) {
+ if (!ol.valsz || (ol.value && strncmp(ol.value, username, ol.valsz))) {
if (ol.valsz)
/* remove old value */
mnt_optstr_remove_option_at(optstr, ol.value, ol.end);
- rc = insert_value(optstr, ol.value, username, NULL);
+ rc = insert_value(optstr, ol.value ? ol.value : ol.end,
+ username, NULL);
}
free(username);