added hooks for sort
[oweals/busybox.git] / umount.c
index 0d105d9c13e0f216dc4a447674484db6d295c4d7..ab76be4da35db8245c4bfca67102dbc8dd6092b7 100644 (file)
--- a/umount.c
+++ b/umount.c
@@ -73,8 +73,13 @@ umount_all(int useMtab)
             while ((m = getmntent (mountTable)) != 0) {
                 char *blockDevice = m->mnt_fsname;
 #if ! defined BB_MTAB
-                if (strcmp (blockDevice, "/dev/root") == 0)
-                    blockDevice = (getfsfile ("/"))->fs_spec;
+               if (strcmp (blockDevice, "/dev/root") == 0) {
+                   struct fstab* fstabItem;
+                   fstabItem = getfsfile ("/");
+                   if (fstabItem != NULL) {
+                       blockDevice = fstabItem->fs_spec;
+                   }
+               }
 #endif
                /* Don't umount /proc when doing umount -a */
                 if (strcmp (blockDevice, "proc") == 0)
@@ -102,7 +107,6 @@ umount_all(int useMtab)
 extern int
 umount_main(int argc, char** argv)
 {
-
     if (argc < 2) {
        usage( umount_usage); 
     }
@@ -124,7 +128,7 @@ umount_main(int argc, char** argv)
     }
 
 
-    if(umountAll) {
+    if(umountAll==TRUE) {
        exit(umount_all(useMtab));
     }
     if ( do_umount(*argv,useMtab) == 0 )