Fix up some silly macros and use xmalloc and friends exclusively.
[oweals/busybox.git] / mount.c
diff --git a/mount.c b/mount.c
index 2353a8ac2b60d0f339083f7ddbee397ec52dfa80..fd68dafd6a3bd1e0786d10ec372685af9027083a 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -83,7 +83,11 @@ extern int mount (__const char *__special_file, __const char *__dir,
                        __const void *__data);
 extern int umount (__const char *__special_file);
 extern int umount2 (__const char *__special_file, int __flags);
-static _syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);
+
+#include <sys/syscall.h>
+#include <linux/unistd.h>
+static int sysfs( int option, unsigned int fs_index, char * buf);
+_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);
 
 
 extern const char mtab_file[]; /* Defined in utility.c */
@@ -235,18 +239,28 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
        int status = 0;
 
        if (strcmp(filesystemType, "auto") == 0) {
-               int i=0;
+               static const char *strings[] = { "tmpfs", "shm", "proc", "ramfs", "devpts", 0 };
+               const char** nodevfss;
                const int num_of_filesystems = sysfs(3, 0, 0);
                char buf[255];
+               int i=0;
+
                filesystemType=buf;
 
                while(i < num_of_filesystems) {
                        sysfs(2, i++, filesystemType);
-                       status = do_mount(blockDevice, directory, filesystemType,
+                       for (nodevfss = strings; *nodevfss; nodevfss++) {
+                               if (!strcmp(filesystemType, *nodevfss)) {
+                                       break;
+                               }
+                       }
+                       if (!*nodevfss) {
+                               status = do_mount(blockDevice, directory, filesystemType,
                                        flags | MS_MGC_VAL, string_flags,
                                        useMtab, fakeIt, mtab_opts);
-                       if (status == TRUE)
-                               break;
+                               if (status == TRUE)
+                                       break;
+                       }
                }
        } else {
                status = do_mount(blockDevice, directory, filesystemType,