bug fix w/ O_NONBLOCK flag.

This commit is contained in:
Kelvin Sherlock 2017-07-27 11:15:34 -04:00
parent f635d32e00
commit a09131a479
1 changed files with 1 additions and 2 deletions

View File

@ -61,7 +61,6 @@ namespace {
#if defined(_WIN32)
#ifdef MSVC
#define AFP_ERROR_FILE_NOT_FOUND ERROR_FILE_NOT_FOUND
#define remap_os_error(x) x
@ -168,7 +167,7 @@ extern "C" int remap_os_error(unsigned long);
/* opens a file read-only and verifies it's a regular file */
int openX(const std::string &path, std::error_code &ec) {
int fd = _(::open(path.c_str(), O_RDONLY, O_NONBLOCK), ec);
int fd = _(::open(path.c_str(), O_RDONLY | O_NONBLOCK), ec);
if (fd >= 0 && !regular_file(fd, ec)) {
::close(fd);
fd = -1;