[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/33] Check the return value of fcntl in qemu_set_cl
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 09/33] Check the return value of fcntl in qemu_set_cloexec |
Date: |
Thu, 1 Jun 2017 14:41:27 +0200 |
From: Stefano Stabellini <address@hidden>
Assert that the return value is not an error. This issue was found by
Coverity.
CID: 1374831
Signed-off-by: Stefano Stabellini <address@hidden>
CC: address@hidden
CC: address@hidden
CC: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
util/oslib-posix.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 4d9189e..16894ad 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);
}
/*
--
1.8.3.1
- [Qemu-devel] [PULL 00/33] Misc patches for 2017-06-01, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 01/33] mc146818rtc: update periodic timer only if it is needed, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 04/33] mc146818rtc: drop unnecessary '#ifdef TARGET_I386', Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 07/33] msix: trace control bit write op, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 03/33] mc146818rtc: ensure LOST_TICK_POLICY_SLEW is only enabled on TARGET_I386, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 02/33] mc146818rtc: precisely count the clock for periodic timer, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 08/33] kvm: irqchip: skip update msi when disabled, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 09/33] Check the return value of fcntl in qemu_set_cloexec,
Paolo Bonzini <=
- [Qemu-devel] [PULL 05/33] mc146818rtc: embrace all x86 specific code, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 10/33] nbd: strict nbd_wr_syncv, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 06/33] kvm: irqchip: trace changes on msi add/remove, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 15/33] exec: simplify phys_page_find() params, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 14/33] nbd/client.c: use errp instead of LOG, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 12/33] nbd: add errp parameter to nbd_wr_syncv(), Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 13/33] nbd: add errp to read_sync, write_sync and drop_sync, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 16/33] virtio-scsi: Unset hotplug handler when unrealize, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 11/33] nbd: read_sync and friends: return 0 on success, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 17/33] vhost-user-scsi: Introduce vhost-user-scsi host device, Paolo Bonzini, 2017/06/01