]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): Close
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 23 Jun 2011 20:02:05 +0000 (22:02 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 23 Jun 2011 20:02:05 +0000 (22:02 +0200)
file after stat.
Reported by: David Volgyes <dvolgyes>.

ChangeLog
grub-core/kern/emu/hostdisk.c

index 058116fbb511856868904dfdb07f4cf1ee7e9e37..abe285ee9616524b4698713065e4bf52b8599e4e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-23  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): Close
+       file after stat.
+       Reported by: David Volgyes <dvolgyes>.
+
 2011-06-23  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * util/raid.c (grub_util_raid_getmembers): Close fd before returning.
index e53a39c39a160eb2c70b4395c90630fc3e80f119..f4af73858d64024f6e6ae5e422c4e4124403a882 100644 (file)
@@ -1866,7 +1866,12 @@ grub_util_biosdisk_is_floppy (grub_disk_t disk)
 
   /* Shouldn't happen either.  */
   if (fstat (fd, &st) < 0)
-    return 0;
+    {
+      close (fd);
+      return 0;
+    }
+
+  close (fd);
 
 #if defined(__NetBSD__)
   if (major(st.st_rdev) == RAW_FLOPPY_MAJOR)