On Fri, Dec 20, 2013 at 11:14:05AM +0100, Stefan Hajnoczi wrote:
> On Thu, Dec 19, 2013 at 10:27:38AM +0800, Hu Tao wrote:
> > +static int raw_preallocate2(int fd, int64_t offset, int64_t length)
> > +{
> > +    int ret = -1;
> > +
> > +    ret = fallocate(fd, 0, offset, length);
> > +
> > +    /* fallback to posix_fallocate() if fallocate() is not supported */
> > +    if (ret < 0 && (errno == ENOSYS || errno == EOPNOTSUPP)) {
> > +        ret = posix_fallocate(fd, offset, length);
> > +    }
> > +
> > +    return ret;
> 
> Return value semantics differ between the two functions:
>  * fallocate - return 0 or -1 with errno set
>  * posix_fallocate - return 0 or error number (without using errno!)
> 
> Please make it consistent.  Usually in QEMU we return 0 on success and
> -errno on failure.

Thanks for catching this!


Reply via email to