Skip to contentSkip to conversation

block.c patch

Qemu-devel Juergen Lock 1 participant 1 message Apr 27, 2005

lore
Share & tools
lore
#0 lore raw

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

block.c +6 -5
diff -u -r1.19 block.c
@@ -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
     {