]> Zhao Yanbai Git Server - minix.git/commitdiff
close device if mount fails after device opened.
authorBen Gras <ben@minix3.org>
Wed, 26 Sep 2007 15:06:41 +0000 (15:06 +0000)
committerBen Gras <ben@minix3.org>
Wed, 26 Sep 2007 15:06:41 +0000 (15:06 +0000)
servers/mfs/mount.c

index 8893307eac068edce13666ba62abec3f887c1a62..2a802b9259c16f8527ddc37f0c32ac666de1d260 100644 (file)
@@ -91,15 +91,21 @@ PUBLIC int fs_readsuper_s()
   /* Is it recognized as a Minix filesystem? */
   if (r != OK) {
        sp->s_dev = NO_DEV;
+       dev_close(driver_e, fs_dev);
        return(r);
   }
   
   /* Get the root inode of the mounted file system. */
-  if ( (root_ip = get_inode(fs_dev, ROOT_INODE)) == NIL_INODE) 
+  if ( (root_ip = get_inode(fs_dev, ROOT_INODE)) == NIL_INODE)  {
+       sp->s_dev = NO_DEV;
+       dev_close(driver_e, fs_dev);
        return err_code;
+  }
   
   if (root_ip != NIL_INODE && root_ip->i_mode == 0) {
         put_inode(root_ip);
+       sp->s_dev = NO_DEV;
+       dev_close(driver_e, fs_dev);
        return EINVAL;
   }