summaryrefslogtreecommitdiffstats
path: root/libmount/src/optstr.c
diff options
context:
space:
mode:
authorKarel Zak2012-06-14 11:38:53 +0200
committerKarel Zak2012-06-14 11:38:53 +0200
commit6b741564d84ee21573b3ebff5510f6b050028d06 (patch)
tree100c9317559bc6380daa231db834e8593401bcd6 /libmount/src/optstr.c
parenteject: cleanup umount code (diff)
downloadkernel-qcow2-util-linux-6b741564d84ee21573b3ebff5510f6b050028d06.tar.gz
kernel-qcow2-util-linux-6b741564d84ee21573b3ebff5510f6b050028d06.tar.xz
kernel-qcow2-util-linux-6b741564d84ee21573b3ebff5510f6b050028d06.zip
libmount: don't generate empty option strings
mount -t foo something /mnt/test -o user=root,password=linux generates "rw,noexec,nosuid,nodev,password=linux,,user=root" options string for /sbin/mount.foo, the ",," is incorrect. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/optstr.c')
-rw-r--r--libmount/src/optstr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
index 66d2a06c3..ca1b2e2c7 100644
--- a/libmount/src/optstr.c
+++ b/libmount/src/optstr.c
@@ -174,6 +174,8 @@ static int __mnt_optstr_append_option(char **optstr,
size_t sz, osz;
assert(name);
+ assert(*name);
+ assert(nsz);
osz = *optstr ? strlen(*optstr) : 0;
@@ -219,7 +221,7 @@ int mnt_optstr_append_option(char **optstr, const char *name, const char *value)
{
size_t vsz, nsz;
- if (!name)
+ if (!name || !*name)
return 0;
nsz = strlen(name);