]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virfile: safezero: fix buffer allocation max size
authorOskari Saarenmaa <os@ohmu.fi>
Fri, 4 Oct 2013 13:49:05 +0000 (16:49 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Oct 2013 14:10:27 +0000 (16:10 +0200)
My previous commit 7dc1d4ab was supposed to change safezero to allocate
1 megabyte at maximum, but had the logic reversed and will allocate 1
megabyte at minimum (and a lot more at maximum.)

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
src/util/virfile.c

index f66212721cb90f60013e6ddd4d07d6f905349b96..e10de5aae725c0b72550b23a618d599162ab2a52 100644 (file)
@@ -1075,7 +1075,7 @@ safezero(int fd, off_t offset, off_t len)
 
     /* Split up the write in small chunks so as not to allocate lots of RAM */
     remain = len;
-    bytes = MAX(1024 * 1024, len);
+    bytes = MIN(1024 * 1024, len);
 
     r = VIR_ALLOC_N(buf, bytes);
     if (r < 0) {