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 <[email protected]>
CC: [email protected]
CC: [email protected]
CC: Eric Blake <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
This commit is contained in:
Stefano Stabellini authored and Paolo Bonzini committed 2017-06-06 20:18:35 +02:00
1 parent fd56356422
commit 7e6478e7d4
1 file changed
+3 -1
+3 -1
View 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);
}
/*