linux: fix error checking in uv__open_file

uv__open_cloexec returns either the fd or a libuv error, which is -errno
on Unix, not -1.

PR-URL: https://github.com/libuv/libuv/pull/760
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
Saúl Ibarra Corretgé 2016-03-10 11:59:48 +01:00
parent 213e681acf
commit 42ebae18d6

View File

@ -433,7 +433,7 @@ FILE* uv__open_file(const char* path) {
FILE* fp;
fd = uv__open_cloexec(path, O_RDONLY);
if (fd == -1)
if (fd < 0)
return NULL;
fp = fdopen(fd, "r");