qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] block.c patch


From: Juergen Lock
Subject: [Qemu-devel] block.c patch
Date: Wed, 27 Apr 2005 19:19:00 +0200

I just saw Fabrice did commit a slightly changed version of the
BSD block.c patch, but its a bit broken (imbalanced brackets).
Here's a fix:

Index: block.c
===================================================================
RCS file: /cvsroot/qemu/qemu/block.c,v
retrieving revision 1.19
diff -u -r1.19 block.c
--- block.c     26 Apr 2005 21:59:26 -0000      1.19
+++ block.c     27 Apr 2005 17:04:23 -0000
@@ -548,6 +548,9 @@
     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 @@
         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
     {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]