]> git.proxmox.com Git - qemu-server.git/commitdiff
fix bug in vmtar
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Oct 2012 08:01:24 +0000 (10:01 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Oct 2012 08:01:24 +0000 (10:01 +0200)
Incompatiple types (size_t/ssize_t) can make vmtar to ignore errors. We now compile
with -Werror and -Wtype-limits to detect such things.

Makefile
changelog.Debian
utils.c
vmtar.c

index 7e0a1c6e521b2573f175dfec0a1703c0d474ed1a..7835a2a83ce30c3409de9bd8e4aa0391552331bd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ RELEASE=2.2
 
 VERSION=2.0
 PACKAGE=qemu-server
-PKGREL=62
+PKGREL=63
 
 DESTDIR=
 PREFIX=/usr
@@ -35,10 +35,10 @@ vzsyscalls.ph: vzsyscalls.h
         h2ph -d . vzsyscalls.h
 
 vmtar: vmtar.c utils.c
-       gcc -O2 -Wall -o vmtar vmtar.c
+       gcc -O2 -Werror -Wall -Wtype-limits -o vmtar vmtar.c
 
 sparsecp: sparsecp.c utils.c
-       gcc -O2 -Wall -o sparsecp sparsecp.c
+       gcc -O2 -Werror -Wall -Wtype-limits -o sparsecp sparsecp.c
 
 %.1.gz: %.1.pod
        rm -f $@
index 285ba63fbc27ec291bfed8fb5bdfe6847fc5947f..ef17485ac92a6f2ad783e9735949f577715d80d9 100644 (file)
@@ -1,3 +1,9 @@
+qemu-server (2.0-63) unstable; urgency=low
+
+  * fix bug in vmtar 
+
+ -- Proxmox Support Team <support@proxmox.com>  Thu, 25 Oct 2012 10:00:50 +0200
+
 qemu-server (2.0-62) unstable; urgency=low
 
   * vncproxy: wait until vnc port is ready
diff --git a/utils.c b/utils.c
index 5187940e2b874a84f9272360e717768a724a469c..c69e0ef58b7492111e1203658b5da7a4bd25b4fe 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -68,7 +68,7 @@ safe_read(int fd, char *buf, size_t count)
 int 
 full_read(int fd, char *buf, size_t len)
 {
-  size_t n;
+  ssize_t n;
   size_t total;
 
   total = 0;
@@ -110,7 +110,7 @@ safe_write(int fd, char *buf, size_t count)
 int 
 full_write(int fd, char *buf, size_t len)
 {
-  size_t n;
+  ssize_t n;
   size_t total;
 
   total = 0;
diff --git a/vmtar.c b/vmtar.c
index 6b34a88bcec53c83d7b5f80d777cc1e46eaf9027..29160b8208dd0b14eec828853fe0e85e405fa774 100644 (file)
--- a/vmtar.c
+++ b/vmtar.c
@@ -402,7 +402,7 @@ dump_sparse_file (int fd, struct writebuffer *wbuf, struct sp_array *ma)
 
     while (bytes_left > 0) {
       size_t bufsize = (bytes_left > BLOCKSIZE) ? BLOCKSIZE : bytes_left;
-      size_t bytes_read;
+      ssize_t bytes_read;
 
       char *blkbuf = buffer_block (wbuf);
       if ((bytes_read = full_read (fd, blkbuf, bufsize)) < 0) {