qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] raw-posix: Handle errors in raw_create


From: Christoph Hellwig
Subject: Re: [Qemu-devel] [PATCH] raw-posix: Handle errors in raw_create
Date: Tue, 14 Jul 2009 23:32:35 +0200
User-agent: Mutt/1.3.28i

On Sat, Jul 11, 2009 at 04:43:37PM +0200, Stefan Weil wrote:
> In qemu-iotests, some large images are created using qemu-img.
> 
> Without checks for errors, qemu-img will just create an
> empty image, and later read / write tests will fail.
> 
> With the patch, failures during image creation are detected
> and reported.

Yeah, we should handle the failures and your patch looks correct in
that respect.  But returning close error codes is in general
not very useful.  There's not much we can do about them, in they
might override the more useful ftruncate error code.

So I'd rather do something like the following:

    if (fd < 0) {
        return -errno;
    }
 
    if (ftruncate(fd, total_size * 512) != 0) {
        result = -errno;
    }

    close(fd);
    return result;





reply via email to

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