diff options
-rw-r--r-- | 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 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. |