From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTGo3-0004D0-Db for qemu-devel@nongnu.org; Wed, 04 Mar 2015 16:26:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTGny-0006Pt-JQ for qemu-devel@nongnu.org; Wed, 04 Mar 2015 16:26:15 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:44154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTGny-0006PL-Bv for qemu-devel@nongnu.org; Wed, 04 Mar 2015 16:26:10 -0500 Message-ID: <54F7786F.2020409@msgid.tls.msk.ru> Date: Thu, 05 Mar 2015 00:26:07 +0300 From: Michael Tokarev MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] 9pfs-proxy: -retval vs errno vs -1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Aneesh Kumar K.V" Cc: qemu-devel , Anthony Liguori 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? Thanks, /mjt