From bf645fda039d09f07b52f97d7a8b66a5e77204ad Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 24 Sep 2013 18:57:19 +0200 Subject: [PATCH] * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_open): Move struct stat immediately to where it's used. --- ChangeLog | 5 +++++ grub-core/kern/emu/hostdisk.c | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7777c5619..2480a9d30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-09-24 Vladimir Serbinenko + + * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_open): Move struct + stat immediately to where it's used. + 2013-09-24 Vladimir Serbinenko * util/getroot.c (grub_util_check_block_device): Move to ... diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c index 260362fa8..60e9344d1 100644 --- a/grub-core/kern/emu/hostdisk.c +++ b/grub-core/kern/emu/hostdisk.c @@ -131,7 +131,6 @@ static grub_err_t grub_util_biosdisk_open (const char *name, grub_disk_t disk) { int drive; - struct stat st; struct grub_util_hostdisk_data *data; drive = find_grub_drive (name); @@ -162,14 +161,16 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk) &disk->log_sector_size); disk->total_sectors >>= disk->log_sector_size; -#if !defined(__MINGW32__) && !defined(__CYGWIN__) - +#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined (__AROS__) + { + struct stat st; # if GRUB_DISK_DEVS_ARE_CHAR - if (fstat (fd, &st) < 0 || ! S_ISCHR (st.st_mode)) + if (fstat (fd, &st) < 0 || ! S_ISCHR (st.st_mode)) # else - if (fstat (fd, &st) < 0 || ! S_ISBLK (st.st_mode)) + if (fstat (fd, &st) < 0 || ! S_ISBLK (st.st_mode)) # endif - data->is_disk = 1; + data->is_disk = 1; + } #endif grub_util_fd_close (fd);