summary refs log tree commit diff stats
path: root/util/oslib-posix.c
diff options
context:
space:
mode:
authorStefano Stabellini <sstabellini@kernel.org>2017-05-09 12:04:52 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2017-06-06 20:18:35 +0200
commit7e6478e7d4f2c4b607069bf488d57089a9d3244b (patch)
tree6809c1027e660e2dc5d43f8af58b36cfabb73ddb /util/oslib-posix.c
parentfd563564222f308e1d86847efdec8555fb472536 (diff)
downloadfocaccia-qemu-7e6478e7d4f2c4b607069bf488d57089a9d3244b.tar.gz
focaccia-qemu-7e6478e7d4f2c4b607069bf488d57089a9d3244b.zip
Check the return value of fcntl in qemu_set_cloexec
Assert that the return value is not an error. This issue was found by
Coverity.

CID: 1374831

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
CC: groug@kaod.org
CC: pbonzini@redhat.com
CC: Eric Blake <eblake@redhat.com>
Message-Id: <1494356693-13190-2-git-send-email-sstabellini@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/oslib-posix.c')
-rw-r--r--util/oslib-posix.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 7e28c161b2..048d40d9de 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -182,7 +182,9 @@ void qemu_set_cloexec(int fd)
 {
     int f;
     f = fcntl(fd, F_GETFD);
-    fcntl(fd, F_SETFD, f | FD_CLOEXEC);
+    assert(f != -1);
+    f = fcntl(fd, F_SETFD, f | FD_CLOEXEC);
+    assert(f != -1);
 }
 
 /*