Received: from eggs.gnu.org ([2001:4830:134:3::10]:52674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YU5Ny-0004kJ-3M for qemu-devel@nongnu.org; Fri, 06 Mar 2015 22:26:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YU5Nu-0002of-Ue for qemu-devel@nongnu.org; Fri, 06 Mar 2015 22:26:42 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:49321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YU5Nu-0002np-My for qemu-devel@nongnu.org; Fri, 06 Mar 2015 22:26:38 -0500 From: Michael Tokarev Date: Fri, 6 Mar 2015 23:19:36 +0300 Message-Id: <1425673176-9819-58-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1425673176-9819-1-git-send-email-mjt@tls.msk.ru> References: <1425673176-9819-1-git-send-email-mjt@tls.msk.ru> Subject: [Qemu-devel] [PATCH 51/51] 9pfs-proxy: tiny cleanups in proxy_pwritev and proxy_preadv List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Aneesh Kumar K.V" Cc: Michael Tokarev , qemu-devel@nongnu.org Signed-off-by: Michael Tokarev --- hw/9pfs/virtio-9p-proxy.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/9pfs/virtio-9p-proxy.c b/hw/9pfs/virtio-9p-proxy.c index aa9659a..1b62e2a 100644 --- a/hw/9pfs/virtio-9p-proxy.c +++ b/hw/9pfs/virtio-9p-proxy.c @@ -436,7 +436,7 @@ static ssize_t proxy_preadv(FsContext *ctx, V9fsFidOpenState *fs, return preadv(fs->fd, iov, iovcnt, offset); #else int err = lseek(fs->fd, offset, SEEK_SET); - if (err == -1) { + if (err < 0) return err; } else { return readv(fs->fd, iov, iovcnt); @@ -453,10 +453,8 @@ static ssize_t proxy_pwritev(FsContext *ctx, V9fsFidOpenState *fs, #ifdef CONFIG_PREADV ret = pwritev(fs->fd, iov, iovcnt, offset); #else - int err = lseek(fs->fd, offset, SEEK_SET); - if (err == -1) { - return err; - } else { + ret = lseek(fs->fd, offset, SEEK_SET); + if (ret >= 0) { ret = writev(fs->fd, iov, iovcnt); } #endif -- 2.1.4