[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 07/49] util: check the return value of fcntl in qe
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 07/49] util: check the return value of fcntl in qemu_set_{block, nonblock} |
Date: |
Tue, 15 Jan 2019 15:04:18 -0500 |
From: Li Qiang <address@hidden>
Assert that the return value is not an error. This is like commit
7e6478e7d4f for qemu_set_cloexec.
Signed-off-by: Li Qiang <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
util/oslib-posix.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index c1bee2a581..4ce1ba9ca4 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -233,14 +233,18 @@ void qemu_set_block(int fd)
{
int f;
f = fcntl(fd, F_GETFL);
- fcntl(fd, F_SETFL, f & ~O_NONBLOCK);
+ assert(f != -1);
+ f = fcntl(fd, F_SETFL, f & ~O_NONBLOCK);
+ assert(f != -1);
}
void qemu_set_nonblock(int fd)
{
int f;
f = fcntl(fd, F_GETFL);
- fcntl(fd, F_SETFL, f | O_NONBLOCK);
+ assert(f != -1);
+ f = fcntl(fd, F_SETFL, f | O_NONBLOCK);
+ assert(f != -1);
}
int socket_set_fast_reuse(int fd)
--
MST
- [Qemu-devel] [PULL v2 00/49] pci, pc, virtio: fixes, features, Michael S. Tsirkin, 2019/01/15
- [Qemu-devel] [PULL v2 14/49] tests: acpi: squash sanitize_fadt_ptrs() into test_acpi_fadt_table(), Michael S. Tsirkin, 2019/01/15
- [Qemu-devel] [PULL v2 06/49] vhost-user: fix ioeventfd_enabled, Michael S. Tsirkin, 2019/01/15
- [Qemu-devel] [PULL v2 05/49] tests: vhost-user-test: initialize 'fd' in chr_read, Michael S. Tsirkin, 2019/01/15
- [Qemu-devel] [PULL v2 13/49] tests: smbios: fetch whole table in one step instead of reading it step by step, Michael S. Tsirkin, 2019/01/15
- [Qemu-devel] [PULL v2 08/49] tests: acpi: use AcpiSdtTable::aml in consistent way, Michael S. Tsirkin, 2019/01/15
- [Qemu-devel] [PULL v2 09/49] tests: acpi: make sure FADT is fetched only once, Michael S. Tsirkin, 2019/01/15