aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-06-22 15:17:18 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2012-06-22 15:17:18 +0200
commit6ebb2b6b242fc4e66100f6ea64101eb75d2071e9 (patch)
tree286b14500f9e4b62ea991ec9929d2f7b753798b0
parenta396ade9f83f05a65b0a6df3dcbdeb8cfef0c696 (diff)
downloadbusybox-w32-6ebb2b6b242fc4e66100f6ea64101eb75d2071e9.tar.gz
busybox-w32-6ebb2b6b242fc4e66100f6ea64101eb75d2071e9.tar.bz2
busybox-w32-6ebb2b6b242fc4e66100f6ea64101eb75d2071e9.zip
mount: do not pass "comment=ANYTHING" option to kernel. Closes 5240
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--util-linux/mount.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 95dee18ec..b6c94d7ba 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -218,6 +218,7 @@ static const int32_t mount_options[] = {
218 IF_DESKTOP(/* "user" */ MOUNT_USERS,) 218 IF_DESKTOP(/* "user" */ MOUNT_USERS,)
219 IF_DESKTOP(/* "users" */ MOUNT_USERS,) 219 IF_DESKTOP(/* "users" */ MOUNT_USERS,)
220 /* "_netdev" */ 0, 220 /* "_netdev" */ 0,
221 IF_DESKTOP(/* "comment" */ 0,) /* systemd uses this in fstab */
221 ) 222 )
222 223
223 IF_FEATURE_MOUNT_FLAGS( 224 IF_FEATURE_MOUNT_FLAGS(
@@ -275,6 +276,7 @@ static const char mount_option_str[] =
275 IF_DESKTOP("user\0") 276 IF_DESKTOP("user\0")
276 IF_DESKTOP("users\0") 277 IF_DESKTOP("users\0")
277 "_netdev\0" 278 "_netdev\0"
279 IF_DESKTOP("comment\0") /* systemd uses this in fstab */
278 ) 280 )
279 IF_FEATURE_MOUNT_FLAGS( 281 IF_FEATURE_MOUNT_FLAGS(
280 // vfs flags 282 // vfs flags
@@ -465,7 +467,11 @@ static unsigned long parse_mount_options(char *options, char **unrecognized)
465// FIXME: use hasmntopt() 467// FIXME: use hasmntopt()
466 // Find this option in mount_options 468 // Find this option in mount_options
467 for (i = 0; i < ARRAY_SIZE(mount_options); i++) { 469 for (i = 0; i < ARRAY_SIZE(mount_options); i++) {
468 if (strcasecmp(option_str, options) == 0) { 470 /* We support "option=" match for "comment=" thingy */
471 unsigned opt_len = strlen(option_str);
472 if (strncasecmp(option_str, options, opt_len) == 0
473 && (options[opt_len] == '\0' || options[opt_len] == '=')
474 ) {
469 unsigned long fl = mount_options[i]; 475 unsigned long fl = mount_options[i];
470 if ((long)fl < 0) 476 if ((long)fl < 0)
471 flags &= fl; 477 flags &= fl;
@@ -473,7 +479,7 @@ static unsigned long parse_mount_options(char *options, char **unrecognized)
473 flags |= fl; 479 flags |= fl;
474 goto found; 480 goto found;
475 } 481 }
476 option_str += strlen(option_str) + 1; 482 option_str += opt_len + 1;
477 } 483 }
478 // We did not recognize this option. 484 // We did not recognize this option.
479 // If "unrecognized" is not NULL, append option there. 485 // If "unrecognized" is not NULL, append option there.