qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] PATCH: remove "control reaches end of non-void function" wa


From: Pavel Janík
Subject: [Qemu-devel] PATCH: remove "control reaches end of non-void function" warnings
Date: Tue, 14 Sep 2004 21:29:57 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

Hi,

the current CVS code doesn't return values in block driver's close
functions although close is defined to return int. No code currently check
for return value, but I think it is better to return value instead of being
void.

Please apply the attached patch which changes close functions
implementations so that they return the value returned by close system
call.

Index: block-cow.c
===================================================================
RCS file: /cvsroot/qemu/qemu/block-cow.c,v
retrieving revision 1.2
diff -u -r1.2 block-cow.c
--- block-cow.c 3 Aug 2004 21:13:54 -0000       1.2
+++ block-cow.c 14 Sep 2004 19:27:07 -0000
@@ -206,7 +206,7 @@
 {
     BDRVCowState *s = bs->opaque;
     munmap(s->cow_bitmap_addr, s->cow_bitmap_size);
-    close(s->fd);
+    return close(s->fd);
 }
 
 static int cow_create(const char *filename, int64_t image_sectors,
Index: block-qcow.c
===================================================================
RCS file: /cvsroot/qemu/qemu/block-qcow.c,v
retrieving revision 1.2
diff -u -r1.2 block-qcow.c
--- block-qcow.c        3 Aug 2004 21:13:54 -0000       1.2
+++ block-qcow.c        14 Sep 2004 19:27:10 -0000
@@ -528,7 +528,7 @@
     qemu_free(s->l2_cache);
     qemu_free(s->cluster_cache);
     qemu_free(s->cluster_data);
-    close(s->fd);
+    return close(s->fd);
 }
 
 static int qcow_create(const char *filename, int64_t total_size,
Index: block-vmdk.c
===================================================================
RCS file: /cvsroot/qemu/qemu/block-vmdk.c,v
retrieving revision 1.3
diff -u -r1.3 block-vmdk.c
--- block-vmdk.c        25 Aug 2004 20:50:14 -0000      1.3
+++ block-vmdk.c        14 Sep 2004 19:27:10 -0000
@@ -263,7 +263,7 @@
     BDRVVmdkState *s = bs->opaque;
     qemu_free(s->l1_table);
     qemu_free(s->l2_cache);
-    close(s->fd);
+    return close(s->fd);
 }
 
 BlockDriver bdrv_vmdk = {
Index: block.c
===================================================================
RCS file: /cvsroot/qemu/qemu/block.c,v
retrieving revision 1.12
diff -u -r1.12 block.c
--- block.c     3 Aug 2004 21:14:09 -0000       1.12
+++ block.c     14 Sep 2004 19:27:11 -0000
@@ -557,7 +557,7 @@
 static int raw_close(BlockDriverState *bs)
 {
     BDRVRawState *s = bs->opaque;
-    close(s->fd);
+    return close(s->fd);
 }
 
 static int raw_create(const char *filename, int64_t total_size,


-- 
Pavel Janík

... oving vim, hating vi."
                  -- Gerhard Haring in python-list




reply via email to

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