summaryrefslogtreecommitdiff
path: root/util-linux/mount.c
diff options
context:
space:
mode:
authorRobert Griebl2002-07-24 01:41:30 +0000
committerRobert Griebl2002-07-24 01:41:30 +0000
commit2a4a8d8ffb67407d4701e3501ec680e9a26f99f6 (patch)
tree9821430e66d223ca19e2cfe62080e6140e5f7f3d /util-linux/mount.c
parent31a2e20bd3ee9795f3d1256bc42df6987d29d3f4 (diff)
downloadbusybox-2a4a8d8ffb67407d4701e3501ec680e9a26f99f6.zip
busybox-2a4a8d8ffb67407d4701e3501ec680e9a26f99f6.tar.gz
Add support for /etc/filesystem when searching for an "auto" filesystem
This is bug #1246
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r--util-linux/mount.c68
1 files changed, 52 insertions, 16 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 3d1f7eb..f6c6472 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -272,25 +272,61 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
#else
if (strcmp(filesystemType, "auto") == 0) {
char buf[255];
- FILE *f = xfopen("/proc/filesystems", "r");
-
- while (fgets(buf, sizeof(buf), f) != NULL) {
- filesystemType = buf;
- if (*filesystemType == '\t') { // Not a nodev filesystem
+ FILE *f;
+ int read_proc = 0;
+
+ f = fopen ( "/etc/filesystems", "r" );
+
+ if ( f ) {
+ while ( fgets ( buf, sizeof( buf ), f )) {
+ if ( *buf == '*' )
+ read_proc = 1;
+ else if ( *buf == '#' )
+ continue;
+ else {
+ filesystemType = buf;
+
+ // Add NULL termination to each line
+ while (*filesystemType && !isspace ( *filesystemType ))
+ filesystemType++;
+ *filesystemType = '\0';
+
+ filesystemType = buf;
+
+ if ( xstrlen ( filesystemType )) {
+ status = do_mount(blockDevice, directory, filesystemType,
+ flags | MS_MGC_VAL, string_flags,
+ useMtab, fakeIt, mtab_opts, mount_all);
+ if (status)
+ break;
+ }
+
+ }
+ }
+ fclose ( f );
+ }
- // Add NULL termination to each line
- while (*filesystemType && *filesystemType != '\n')
- filesystemType++;
- *filesystemType = '\0';
+ if (( !f || read_proc ) && !status ) {
+ f = xfopen("/proc/filesystems", "r");
+ while (fgets(buf, sizeof(buf), f) != NULL) {
filesystemType = buf;
- filesystemType++; // hop past tab
-
- status = do_mount(blockDevice, directory, filesystemType,
- flags | MS_MGC_VAL, string_flags,
- useMtab, fakeIt, mtab_opts, mount_all);
- if (status)
- break;
+ if (*filesystemType == '\t') { // Not a nodev filesystem
+
+ // Add NULL termination to each line
+ while (*filesystemType && *filesystemType != '\n')
+ filesystemType++;
+ *filesystemType = '\0';
+
+ filesystemType = buf;
+ filesystemType++; // hop past tab
+
+ status = do_mount(blockDevice, directory, filesystemType,
+ flags | MS_MGC_VAL, string_flags,
+ useMtab, fakeIt, mtab_opts, mount_all);
+ if (status)
+ break;
+ }
}
}
fclose(f);