[Top][All Lists]

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

[Qemu-devel] 9pfs-proxy: -retval vs errno vs -1

From: Michael Tokarev
Subject: [Qemu-devel] 9pfs-proxy: -retval vs errno vs -1
Date: Thu, 05 Mar 2015 00:26:07 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0

Another interesting tidbit is in hw/9pfs/virtio-9p-proxy.c.

All filesystem methods use common v9fs_request() function,
which returns -errno.  So far so good.

Now, *all* places which call this function, does this:

    retval = v9fs_request(...);
    if (retval < 0) {
        errno = -retval;
    return retval;

and *some* does this:

    retval = v9fs_request(...);
    if (retval < 0) {
        errno = -retval;
        retval = -1;
    return retval;

So basically, *all* places sets errno in case of negative
return from v9fs_request(), but only some of them make the
return value to be -1 instead of original negative value.

So I've two questions here.

1. Why some filesystem methods return -1 while some return -errno?
2. Why can't v9fs_request() set errno itself?



reply via email to

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