Message ID | 20101008173908.GQ24658@blackpad.lan.raisama.net |
---|---|
State | New |
Headers | show |
diff --git a/block/qcow2.c b/block/qcow2.c index c5fb28e..e2e9a95 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -882,7 +882,7 @@ static int qcow_create2(const char *filename, int64_t total_size, uint64_t old_ref_clusters; QCowCreateState s1, *s = &s1; QCowExtension ext_bf = {0, 0}; - int ret; + int ret, cret; memset(s, 0, sizeof(*s)); @@ -1055,7 +1055,10 @@ exit: qemu_free(s->refcount_block); exit_close: - close(fd); + cret = close(fd); + if (ret == 0 && cret < 0) { + ret = -errno; + } /* Preallocate metadata */ if (ret == 0 && prealloc) {