From cad3237fb5ecf1a21f9e1bad957942a0cac8d6cc Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 23 Jun 2011 22:02:05 +0200 Subject: [PATCH] * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): Close file after stat. Reported by: David Volgyes . --- ChangeLog | 6 ++++++ grub-core/kern/emu/hostdisk.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 058116fbb..abe285ee9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-06-23 Vladimir Serbinenko + + * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): Close + file after stat. + Reported by: David Volgyes . + 2011-06-23 Vladimir Serbinenko * util/raid.c (grub_util_raid_getmembers): Close fd before returning. diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c index e53a39c39..f4af73858 100644 --- a/grub-core/kern/emu/hostdisk.c +++ b/grub-core/kern/emu/hostdisk.c @@ -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)