]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libmount: make sure "option=" is used as string
authorKarel Zak <kzak@redhat.com>
Wed, 20 Mar 2024 15:08:16 +0000 (16:08 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 22 Mar 2024 10:34:08 +0000 (11:34 +0100)
commit175af5cb8e0434bbc6660f7ccbea3a188d8f2d72
tree8ebed0f00db8da8f0d3d89dc5aff1f35042a4b00
parent8beae411393d565778a80d3513be8b68bf5967fa
libmount: make sure "option=" is used as string

mount(8) cares about case when option specified as "name=" (it means
without data). See for example 727c689908c5e68c92aa1dd65e0d3bdb6d91c1e5.

We need this also for new mount API and use FSCONFIG_SET_STRING rather
than FSCONFIG_SET_FLAG.

strace -e fsconfig ./mount -o usrjquota= /dev/sdc1 /mnt/test

Old:
fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sdc1", 0) = 0
fsconfig(3, FSCONFIG_SET_FLAG, "usrjquota", NULL, 0) = -1 EINVAL (Invalid argument)

Fixed:
fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sdc1", 0) = 0
fsconfig(3, FSCONFIG_SET_STRING, "usrjquota", "", 0) = 0

Fixes: https://github.com/util-linux/util-linux/issues/2837
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 0c5485348b155420ecd1bfcdabb1b869ca5ee3c2)
libmount/src/hook_mount.c
libmount/src/mountP.h
libmount/src/optlist.c