Signed-off-by: Michael Tokarev <m...@tls.msk.ru>
---
 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 c7b2f16..8e7ce3f 100644
--- a/hw/9pfs/virtio-9p-proxy.c
+++ b/hw/9pfs/virtio-9p-proxy.c
@@ -606,7 +606,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);
@@ -623,10 +623,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


Reply via email to