]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Check the return value of fcntl in qemu_set_cloexec
authorStefano Stabellini <sstabellini@kernel.org>
Tue, 9 May 2017 19:04:52 +0000 (12:04 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 6 Jun 2017 18:18:35 +0000 (20:18 +0200)
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>
util/oslib-posix.c

index 7e28c161b2573c1aae82fcfdd471f8f474a68d6c..048d40d9de708e64181347b077c8df5402f86e84 100644 (file)
@@ -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);
 }
 
 /*