diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-10-18 04:10:22 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-10-18 04:10:22 +0000 |
commit | 8acbf1d3079e9ed6d15c39bd57135b13ecb4076f (patch) | |
tree | ce1a2059658a8763b0db8c4174deff95935bb969 | |
parent | 11fdb8a4c79752157a8263fbcf583916d5ec0347 (diff) | |
download | busybox-w32-8acbf1d3079e9ed6d15c39bd57135b13ecb4076f.tar.gz busybox-w32-8acbf1d3079e9ed6d15c39bd57135b13ecb4076f.tar.bz2 busybox-w32-8acbf1d3079e9ed6d15c39bd57135b13ecb4076f.zip |
Make mount default to using /proc/filesystems to avoid
ever trying to mount a nodev filesystem.
-Erik
-rw-r--r-- | mount.c | 33 | ||||
-rw-r--r-- | util-linux/mount.c | 33 |
2 files changed, 62 insertions, 4 deletions
@@ -240,6 +240,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
240 | { | 240 | { |
241 | int status = 0; | 241 | int status = 0; |
242 | 242 | ||
243 | #if defined BB_FEATURE_USE_DEVPS_PATCH | ||
243 | if (strcmp(filesystemType, "auto") == 0) { | 244 | if (strcmp(filesystemType, "auto") == 0) { |
244 | static const char *noauto_array[] = { "tmpfs", "shm", "proc", "ramfs", "devpts", "devfs", "usbdevfs", 0 }; | 245 | static const char *noauto_array[] = { "tmpfs", "shm", "proc", "ramfs", "devpts", "devfs", "usbdevfs", 0 }; |
245 | const char **noauto_fstype; | 246 | const char **noauto_fstype; |
@@ -264,7 +265,35 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
264 | break; | 265 | break; |
265 | } | 266 | } |
266 | } | 267 | } |
267 | } else { | 268 | } |
269 | #else | ||
270 | if (strcmp(filesystemType, "auto") == 0) { | ||
271 | char buf[255]; | ||
272 | FILE *f = xfopen("/proc/filesystems", "r"); | ||
273 | |||
274 | while (fgets(buf, sizeof(buf), f) != NULL) { | ||
275 | filesystemType = buf; | ||
276 | if (*filesystemType == '\t') { // Not a nodev filesystem | ||
277 | |||
278 | // Add NULL termination to each line | ||
279 | while (*filesystemType && *filesystemType != '\n') | ||
280 | filesystemType++; | ||
281 | *filesystemType = '\0'; | ||
282 | |||
283 | filesystemType = buf; | ||
284 | filesystemType++; // hop past tab | ||
285 | |||
286 | status = do_mount(blockDevice, directory, filesystemType, | ||
287 | flags | MS_MGC_VAL, string_flags, | ||
288 | useMtab, fakeIt, mtab_opts, mount_all); | ||
289 | if (status == TRUE) | ||
290 | break; | ||
291 | } | ||
292 | } | ||
293 | fclose(f); | ||
294 | } | ||
295 | #endif | ||
296 | else { | ||
268 | status = do_mount(blockDevice, directory, filesystemType, | 297 | status = do_mount(blockDevice, directory, filesystemType, |
269 | flags | MS_MGC_VAL, string_flags, useMtab, | 298 | flags | MS_MGC_VAL, string_flags, useMtab, |
270 | fakeIt, mtab_opts, mount_all); | 299 | fakeIt, mtab_opts, mount_all); |
@@ -279,7 +308,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
279 | return (TRUE); | 308 | return (TRUE); |
280 | } | 309 | } |
281 | 310 | ||
282 | void show_mounts() | 311 | void show_mounts(void) |
283 | { | 312 | { |
284 | #if defined BB_FEATURE_USE_DEVPS_PATCH | 313 | #if defined BB_FEATURE_USE_DEVPS_PATCH |
285 | int fd, i, numfilesystems; | 314 | int fd, i, numfilesystems; |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 2fc84f2c0..af57a7623 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -240,6 +240,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
240 | { | 240 | { |
241 | int status = 0; | 241 | int status = 0; |
242 | 242 | ||
243 | #if defined BB_FEATURE_USE_DEVPS_PATCH | ||
243 | if (strcmp(filesystemType, "auto") == 0) { | 244 | if (strcmp(filesystemType, "auto") == 0) { |
244 | static const char *noauto_array[] = { "tmpfs", "shm", "proc", "ramfs", "devpts", "devfs", "usbdevfs", 0 }; | 245 | static const char *noauto_array[] = { "tmpfs", "shm", "proc", "ramfs", "devpts", "devfs", "usbdevfs", 0 }; |
245 | const char **noauto_fstype; | 246 | const char **noauto_fstype; |
@@ -264,7 +265,35 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
264 | break; | 265 | break; |
265 | } | 266 | } |
266 | } | 267 | } |
267 | } else { | 268 | } |
269 | #else | ||
270 | if (strcmp(filesystemType, "auto") == 0) { | ||
271 | char buf[255]; | ||
272 | FILE *f = xfopen("/proc/filesystems", "r"); | ||
273 | |||
274 | while (fgets(buf, sizeof(buf), f) != NULL) { | ||
275 | filesystemType = buf; | ||
276 | if (*filesystemType == '\t') { // Not a nodev filesystem | ||
277 | |||
278 | // Add NULL termination to each line | ||
279 | while (*filesystemType && *filesystemType != '\n') | ||
280 | filesystemType++; | ||
281 | *filesystemType = '\0'; | ||
282 | |||
283 | filesystemType = buf; | ||
284 | filesystemType++; // hop past tab | ||
285 | |||
286 | status = do_mount(blockDevice, directory, filesystemType, | ||
287 | flags | MS_MGC_VAL, string_flags, | ||
288 | useMtab, fakeIt, mtab_opts, mount_all); | ||
289 | if (status == TRUE) | ||
290 | break; | ||
291 | } | ||
292 | } | ||
293 | fclose(f); | ||
294 | } | ||
295 | #endif | ||
296 | else { | ||
268 | status = do_mount(blockDevice, directory, filesystemType, | 297 | status = do_mount(blockDevice, directory, filesystemType, |
269 | flags | MS_MGC_VAL, string_flags, useMtab, | 298 | flags | MS_MGC_VAL, string_flags, useMtab, |
270 | fakeIt, mtab_opts, mount_all); | 299 | fakeIt, mtab_opts, mount_all); |
@@ -279,7 +308,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
279 | return (TRUE); | 308 | return (TRUE); |
280 | } | 309 | } |
281 | 310 | ||
282 | void show_mounts() | 311 | void show_mounts(void) |
283 | { | 312 | { |
284 | #if defined BB_FEATURE_USE_DEVPS_PATCH | 313 | #if defined BB_FEATURE_USE_DEVPS_PATCH |
285 | int fd, i, numfilesystems; | 314 | int fd, i, numfilesystems; |