Add support for /etc/filesystem when searching for an "auto" filesystem
This is bug #1246
This commit is contained in:
parent
31a2e20bd3
commit
2a4a8d8ffb
@ -272,25 +272,61 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
|||||||
#else
|
#else
|
||||||
if (strcmp(filesystemType, "auto") == 0) {
|
if (strcmp(filesystemType, "auto") == 0) {
|
||||||
char buf[255];
|
char buf[255];
|
||||||
FILE *f = xfopen("/proc/filesystems", "r");
|
FILE *f;
|
||||||
|
int read_proc = 0;
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), f) != NULL) {
|
f = fopen ( "/etc/filesystems", "r" );
|
||||||
filesystemType = buf;
|
|
||||||
if (*filesystemType == '\t') { // Not a nodev filesystem
|
|
||||||
|
|
||||||
// Add NULL termination to each line
|
if ( f ) {
|
||||||
while (*filesystemType && *filesystemType != '\n')
|
while ( fgets ( buf, sizeof( buf ), f )) {
|
||||||
filesystemType++;
|
if ( *buf == '*' )
|
||||||
*filesystemType = '\0';
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (( !f || read_proc ) && !status ) {
|
||||||
|
f = xfopen("/proc/filesystems", "r");
|
||||||
|
|
||||||
|
while (fgets(buf, sizeof(buf), f) != NULL) {
|
||||||
filesystemType = buf;
|
filesystemType = buf;
|
||||||
filesystemType++; // hop past tab
|
if (*filesystemType == '\t') { // Not a nodev filesystem
|
||||||
|
|
||||||
status = do_mount(blockDevice, directory, filesystemType,
|
// Add NULL termination to each line
|
||||||
flags | MS_MGC_VAL, string_flags,
|
while (*filesystemType && *filesystemType != '\n')
|
||||||
useMtab, fakeIt, mtab_opts, mount_all);
|
filesystemType++;
|
||||||
if (status)
|
*filesystemType = '\0';
|
||||||
break;
|
|
||||||
|
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);
|
fclose(f);
|
||||||
|
Loading…
Reference in New Issue
Block a user