summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/optstr.c
diff options
context:
space:
mode:
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);