X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=libfio.c;h=8af11297e17c5eed31bd3e23df72ed40c1bfab25;hp=5ed8c6073603d4edb0b381fb356694cce600e04b;hb=3a35845f7756a8a86b420650bff41267192dce22;hpb=affe05a916636af786ee66925038f6f2c74cf526 diff --git a/libfio.c b/libfio.c index 5ed8c607..8af11297 100644 --- a/libfio.c +++ b/libfio.c @@ -234,7 +234,7 @@ int fio_running_or_pending_io_threads(void) return 0; } -void fio_set_fd_nonblocking(int fd, const char *who) +int fio_set_fd_nonblocking(int fd, const char *who) { int flags; @@ -242,11 +242,14 @@ void fio_set_fd_nonblocking(int fd, const char *who) if (flags < 0) log_err("fio: %s failed to get file flags: %s\n", who, strerror(errno)); else { - flags |= O_NONBLOCK; - flags = fcntl(fd, F_SETFL, flags); - if (flags < 0) + int new_flags = flags | O_NONBLOCK; + + new_flags = fcntl(fd, F_SETFL, new_flags); + if (new_flags < 0) log_err("fio: %s failed to get file flags: %s\n", who, strerror(errno)); } + + return flags; } static int endian_check(void)