diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-02 18:52:49 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-02 18:52:49 +0000 |
commit | 546cd1881a1501923badf55b2c9f53f191c3f8d6 (patch) | |
tree | 6445aaf0c3938f135beb123e88720ef23fd59da3 | |
parent | e2016e145b499f257dff1011f1608490a49fdb7e (diff) | |
download | busybox-w32-546cd1881a1501923badf55b2c9f53f191c3f8d6.tar.gz busybox-w32-546cd1881a1501923badf55b2c9f53f191c3f8d6.tar.bz2 busybox-w32-546cd1881a1501923badf55b2c9f53f191c3f8d6.zip |
mount: accept and ignore -s (sloppy) option.
needed for compatibility with Linux automounter.
-rw-r--r-- | util-linux/mount.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index 9b93986c2..565dccd9a 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -92,7 +92,7 @@ struct { | |||
92 | {"remount", MS_REMOUNT}, // action flag | 92 | {"remount", MS_REMOUNT}, // action flag |
93 | }; | 93 | }; |
94 | 94 | ||
95 | 95 | #define VECTOR_SIZE(v) (sizeof(v) / sizeof((v)[0])) | |
96 | 96 | ||
97 | /* Append mount options to string */ | 97 | /* Append mount options to string */ |
98 | static void append_mount_options(char **oldopts, char *newopts) | 98 | static void append_mount_options(char **oldopts, char *newopts) |
@@ -139,7 +139,7 @@ static int parse_mount_options(char *options, char **unrecognized) | |||
139 | if (comma) *comma = 0; | 139 | if (comma) *comma = 0; |
140 | 140 | ||
141 | // Find this option in mount_options | 141 | // Find this option in mount_options |
142 | for (i = 0; i < (sizeof(mount_options) / sizeof(*mount_options)); i++) { | 142 | for (i = 0; i < VECTOR_SIZE(mount_options); i++) { |
143 | if (!strcasecmp(mount_options[i].name, options)) { | 143 | if (!strcasecmp(mount_options[i].name, options)) { |
144 | long fl = mount_options[i].flags; | 144 | long fl = mount_options[i].flags; |
145 | if (fl < 0) flags &= fl; | 145 | if (fl < 0) flags &= fl; |
@@ -148,9 +148,7 @@ static int parse_mount_options(char *options, char **unrecognized) | |||
148 | } | 148 | } |
149 | } | 149 | } |
150 | // If unrecognized not NULL, append unrecognized mount options */ | 150 | // If unrecognized not NULL, append unrecognized mount options */ |
151 | if (unrecognized | 151 | if (unrecognized && i == VECTOR_SIZE(mount_options)) { |
152 | && i == (sizeof(mount_options) / sizeof(*mount_options))) | ||
153 | { | ||
154 | // Add it to strflags, to pass on to kernel | 152 | // Add it to strflags, to pass on to kernel |
155 | i = *unrecognized ? strlen(*unrecognized) : 0; | 153 | i = *unrecognized ? strlen(*unrecognized) : 0; |
156 | *unrecognized = xrealloc(*unrecognized, i+strlen(options)+2); | 154 | *unrecognized = xrealloc(*unrecognized, i+strlen(options)+2); |
@@ -1446,7 +1444,7 @@ int mount_main(int argc, char **argv) | |||
1446 | 1444 | ||
1447 | // Parse remaining options | 1445 | // Parse remaining options |
1448 | 1446 | ||
1449 | opt = bb_getopt_ulflags(argc, argv, "o:t:rwanfv", &opt_o, &fstype); | 1447 | opt = bb_getopt_ulflags(argc, argv, "o:t:rwanfvs", &opt_o, &fstype); |
1450 | if (opt & 0x1) append_mount_options(&cmdopts, opt_o); // -o | 1448 | if (opt & 0x1) append_mount_options(&cmdopts, opt_o); // -o |
1451 | //if (opt & 0x2) // -t | 1449 | //if (opt & 0x2) // -t |
1452 | if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r | 1450 | if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r |
@@ -1454,7 +1452,8 @@ int mount_main(int argc, char **argv) | |||
1454 | //if (opt & 0x10) // -a | 1452 | //if (opt & 0x10) // -a |
1455 | if (opt & 0x20) USE_FEATURE_MTAB_SUPPORT(useMtab = 0); // -n | 1453 | if (opt & 0x20) USE_FEATURE_MTAB_SUPPORT(useMtab = 0); // -n |
1456 | if (opt & 0x40) USE_FEATURE_MTAB_SUPPORT(fakeIt = 1); // -f | 1454 | if (opt & 0x40) USE_FEATURE_MTAB_SUPPORT(fakeIt = 1); // -f |
1457 | //if (opt & 0x80) // -v: ignore | 1455 | //if (opt & 0x80) // -v: verbose (ignore) |
1456 | //if (opt & 0x100) // -s: sloppy (ignore) | ||
1458 | argv += optind; | 1457 | argv += optind; |
1459 | argc -= optind; | 1458 | argc -= optind; |
1460 | 1459 | ||
@@ -1499,8 +1498,10 @@ int mount_main(int argc, char **argv) | |||
1499 | goto clean_up; | 1498 | goto clean_up; |
1500 | } | 1499 | } |
1501 | 1500 | ||
1501 | i = parse_mount_options(cmdopts, 0); | ||
1502 | |||
1502 | // If we have a shared subtree flag, don't worry about fstab or mtab. | 1503 | // If we have a shared subtree flag, don't worry about fstab or mtab. |
1503 | i = parse_mount_options(cmdopts,0); | 1504 | |
1504 | if (ENABLE_FEATURE_MOUNT_FLAGS && | 1505 | if (ENABLE_FEATURE_MOUNT_FLAGS && |
1505 | (i & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE ))) | 1506 | (i & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE ))) |
1506 | { | 1507 | { |
@@ -1511,17 +1512,16 @@ int mount_main(int argc, char **argv) | |||
1511 | 1512 | ||
1512 | // Open either fstab or mtab | 1513 | // Open either fstab or mtab |
1513 | 1514 | ||
1514 | if (parse_mount_options(cmdopts,0) & MS_REMOUNT) | 1515 | if (i & MS_REMOUNT) |
1515 | fstabname = bb_path_mtab_file; | 1516 | fstabname = bb_path_mtab_file; |
1516 | else fstabname = "/etc/fstab"; | 1517 | else fstabname = "/etc/fstab"; |
1517 | |||
1518 | fstab = setmntent(fstabname,"r"); | 1518 | fstab = setmntent(fstabname,"r"); |
1519 | if (!fstab) | 1519 | if (!fstab) |
1520 | bb_perror_msg_and_die("cannot read %s", fstabname); | 1520 | bb_perror_msg_and_die("cannot read %s", fstabname); |
1521 | 1521 | ||
1522 | // Loop through entries until we find what we're looking for. | 1522 | // Loop through entries until we find what we're looking for. |
1523 | 1523 | ||
1524 | memset(mtpair,0,sizeof(mtpair)); | 1524 | memset(mtpair, 0, sizeof(mtpair)); |
1525 | for (;;) { | 1525 | for (;;) { |
1526 | struct mntent *mtnext = (mtcur==mtpair ? mtpair+1 : mtpair); | 1526 | struct mntent *mtnext = (mtcur==mtpair ? mtpair+1 : mtpair); |
1527 | 1527 | ||