When mounting a filesystem without any additional options (data parameter to the mount(2) syscall), pass NULL instead of an empty string like GNU mount does. This fixes, for example mounting cgroup fs with bbox mount.
Signed-off-by: Alexander Shishkin <[email protected]> --- util-linux/mount.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/util-linux/mount.c b/util-linux/mount.c index d1d6889..9105df1 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -356,8 +356,14 @@ static long parse_mount_options(char *options, char **unrecognized) } option_str += strlen(option_str) + 1; } - // If unrecognized not NULL, append unrecognized mount options - if (unrecognized && i == ARRAY_SIZE(mount_options)) { + // If unrecognized is not NULL, append unrecognized non-empty + // mount options; otherwise leave unrecognized unchanged so + // that NULL is passed as 'data' parameter to mount(2) syscall + // instead of an empty string (the way GNU mount does it). This + // is crucial for mounting filesystems that don't accept any + // arbitrary mount options, like cgroup fs: + // $ mount -t cgroup none /mnt + if (*options && unrecognized && i == ARRAY_SIZE(mount_options)) { // Add it to strflags, to pass on to kernel i = *unrecognized ? strlen(*unrecognized) : 0; *unrecognized = xrealloc(*unrecognized, i + strlen(options) + 2); -- 1.7.1 _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
