summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-04-27 19:55:01 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-04-27 19:55:01 +0000
commite5484d339114117920753c4045bed75510215862 (patch)
tree567cedc6a6e5bd76416429a28be615e57ac0deb8 /block.c
parent7674e7bf08c0be8e6872f8602e2d875b3efb6903 (diff)
BSD fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1413 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block.c')
-rw-r--r--block.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/block.c b/block.c
index cbe07a9d8f..ce1c388b97 100644
--- a/block.c
+++ b/block.c
@@ -548,6 +548,9 @@ static int raw_open(BlockDriverState *bs, const char *filename)
BDRVRawState *s = bs->opaque;
int fd;
int64_t size;
+#ifdef _BSD
+ struct stat sb;
+#endif
fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
if (fd < 0) {
@@ -557,13 +560,11 @@ static int raw_open(BlockDriverState *bs, const char *filename)
bs->read_only = 1;
}
#ifdef _BSD
- {
- struct stat sb;
- if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) {
+ if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) {
#ifdef DIOCGMEDIASIZE
- if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size))
+ if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size))
#endif
- size = lseek(fd, 0LL, SEEK_END);
+ size = lseek(fd, 0LL, SEEK_END);
} else
#endif
{