diff options
| author | sandman <sandman@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-07-24 01:41:30 +0000 |
|---|---|---|
| committer | sandman <sandman@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-07-24 01:41:30 +0000 |
| commit | 3476e09a992fe1f95f53da5e248e1f94853fdaca (patch) | |
| tree | 9821430e66d223ca19e2cfe62080e6140e5f7f3d /util-linux | |
| parent | 74a046bc10a9452b429e07c27689e8a1fc19ab90 (diff) | |
| download | busybox-w32-3476e09a992fe1f95f53da5e248e1f94853fdaca.tar.gz busybox-w32-3476e09a992fe1f95f53da5e248e1f94853fdaca.tar.bz2 busybox-w32-3476e09a992fe1f95f53da5e248e1f94853fdaca.zip | |
Add support for /etc/filesystem when searching for an "auto" filesystem
This is bug #1246
git-svn-id: svn://busybox.net/trunk/busybox@5085 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/mount.c | 68 |
1 files changed, 52 insertions, 16 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index 3d1f7ebbf..f6c647259 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
| @@ -272,25 +272,61 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
| 272 | #else | 272 | #else |
| 273 | if (strcmp(filesystemType, "auto") == 0) { | 273 | if (strcmp(filesystemType, "auto") == 0) { |
| 274 | char buf[255]; | 274 | char buf[255]; |
| 275 | FILE *f = xfopen("/proc/filesystems", "r"); | 275 | FILE *f; |
| 276 | 276 | int read_proc = 0; | |
| 277 | while (fgets(buf, sizeof(buf), f) != NULL) { | 277 | |
| 278 | filesystemType = buf; | 278 | f = fopen ( "/etc/filesystems", "r" ); |
| 279 | if (*filesystemType == '\t') { // Not a nodev filesystem | 279 | |
| 280 | if ( f ) { | ||
| 281 | while ( fgets ( buf, sizeof( buf ), f )) { | ||
| 282 | if ( *buf == '*' ) | ||
| 283 | read_proc = 1; | ||
| 284 | else if ( *buf == '#' ) | ||
| 285 | continue; | ||
| 286 | else { | ||
| 287 | filesystemType = buf; | ||
| 288 | |||
| 289 | // Add NULL termination to each line | ||
| 290 | while (*filesystemType && !isspace ( *filesystemType )) | ||
| 291 | filesystemType++; | ||
| 292 | *filesystemType = '\0'; | ||
| 293 | |||
| 294 | filesystemType = buf; | ||
| 295 | |||
| 296 | if ( xstrlen ( filesystemType )) { | ||
| 297 | status = do_mount(blockDevice, directory, filesystemType, | ||
| 298 | flags | MS_MGC_VAL, string_flags, | ||
| 299 | useMtab, fakeIt, mtab_opts, mount_all); | ||
| 300 | if (status) | ||
| 301 | break; | ||
| 302 | } | ||
| 303 | |||
| 304 | } | ||
| 305 | } | ||
| 306 | fclose ( f ); | ||
| 307 | } | ||
| 280 | 308 | ||
| 281 | // Add NULL termination to each line | 309 | if (( !f || read_proc ) && !status ) { |
| 282 | while (*filesystemType && *filesystemType != '\n') | 310 | f = xfopen("/proc/filesystems", "r"); |
| 283 | filesystemType++; | ||
| 284 | *filesystemType = '\0'; | ||
| 285 | 311 | ||
| 312 | while (fgets(buf, sizeof(buf), f) != NULL) { | ||
| 286 | filesystemType = buf; | 313 | filesystemType = buf; |
| 287 | filesystemType++; // hop past tab | 314 | if (*filesystemType == '\t') { // Not a nodev filesystem |
| 288 | 315 | ||
| 289 | status = do_mount(blockDevice, directory, filesystemType, | 316 | // Add NULL termination to each line |
| 290 | flags | MS_MGC_VAL, string_flags, | 317 | while (*filesystemType && *filesystemType != '\n') |
| 291 | useMtab, fakeIt, mtab_opts, mount_all); | 318 | filesystemType++; |
| 292 | if (status) | 319 | *filesystemType = '\0'; |
| 293 | break; | 320 | |
| 321 | filesystemType = buf; | ||
| 322 | filesystemType++; // hop past tab | ||
| 323 | |||
| 324 | status = do_mount(blockDevice, directory, filesystemType, | ||
| 325 | flags | MS_MGC_VAL, string_flags, | ||
| 326 | useMtab, fakeIt, mtab_opts, mount_all); | ||
| 327 | if (status) | ||
| 328 | break; | ||
| 329 | } | ||
| 294 | } | 330 | } |
| 295 | } | 331 | } |
| 296 | fclose(f); | 332 | fclose(f); |
