image_types_nfi.bbclass: add option nofail to /data
[opendreambox.git] / meta-opendreambox / recipes-core / busybox / busybox-1.20.2 / 0007-mount-do-not-pass-comment-ANYTHING-option-to-kernel..patch
1 From f811fca1f55401d9ea803f2f2c98c99768316800 Mon Sep 17 00:00:00 2001
2 From: Denys Vlasenko <vda.linux@googlemail.com>
3 Date: Fri, 22 Jun 2012 15:17:18 +0200
4 Subject: [PATCH 7/8] mount: do not pass "comment=ANYTHING" option to kernel.
5  Closes 5240
6
7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 ---
9  util-linux/mount.c |   10 ++++++++--
10  1 file changed, 8 insertions(+), 2 deletions(-)
11
12 diff --git a/util-linux/mount.c b/util-linux/mount.c
13 index 95dee18..b6c94d7 100644
14 --- a/util-linux/mount.c
15 +++ b/util-linux/mount.c
16 @@ -218,6 +218,7 @@ static const int32_t mount_options[] = {
17                 IF_DESKTOP(/* "user"  */ MOUNT_USERS,)
18                 IF_DESKTOP(/* "users" */ MOUNT_USERS,)
19                 /* "_netdev" */ 0,
20 +               IF_DESKTOP(/* "comment" */ 0,) /* systemd uses this in fstab */
21         )
22  
23         IF_FEATURE_MOUNT_FLAGS(
24 @@ -275,6 +276,7 @@ static const char mount_option_str[] =
25                 IF_DESKTOP("user\0")
26                 IF_DESKTOP("users\0")
27                 "_netdev\0"
28 +               IF_DESKTOP("comment\0") /* systemd uses this in fstab */
29         )
30         IF_FEATURE_MOUNT_FLAGS(
31                 // vfs flags
32 @@ -465,7 +467,11 @@ static unsigned long parse_mount_options(char *options, char **unrecognized)
33  // FIXME: use hasmntopt()
34                 // Find this option in mount_options
35                 for (i = 0; i < ARRAY_SIZE(mount_options); i++) {
36 -                       if (strcasecmp(option_str, options) == 0) {
37 +                       /* We support "option=" match for "comment=" thingy */
38 +                       unsigned opt_len = strlen(option_str);
39 +                       if (strncasecmp(option_str, options, opt_len) == 0
40 +                        && (options[opt_len] == '\0' || options[opt_len] == '=')
41 +                       ) {
42                                 unsigned long fl = mount_options[i];
43                                 if ((long)fl < 0)
44                                         flags &= fl;
45 @@ -473,7 +479,7 @@ static unsigned long parse_mount_options(char *options, char **unrecognized)
46                                         flags |= fl;
47                                 goto found;
48                         }
49 -                       option_str += strlen(option_str) + 1;
50 +                       option_str += opt_len + 1;
51                 }
52                 // We did not recognize this option.
53                 // If "unrecognized" is not NULL, append option there.
54 -- 
55 1.7.10.4
56