aix: don't EISDIR on read from directory fd
Remove the artificial EISDIR that was generated when trying to uv_fs_read() from a file descriptor that refers to a directory. We don't do that on the BSDs either (where reading from a directory is allowed) and it introduces an extra stat() call for every read. Refs: https://github.com/libuv/libuv/pull/2023#issuecomment-427759265 PR-URL: https://github.com/libuv/libuv/pull/2025 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
parent
672b96fab4
commit
25a3894c8d
@ -265,18 +265,6 @@ static ssize_t uv__fs_read(uv_fs_t* req) {
|
||||
unsigned int iovmax;
|
||||
ssize_t result;
|
||||
|
||||
#if defined(_AIX)
|
||||
struct stat buf;
|
||||
result = fstat(req->file, &buf);
|
||||
if (result)
|
||||
goto done;
|
||||
if (S_ISDIR(buf.st_mode)) {
|
||||
errno = EISDIR;
|
||||
result -1;
|
||||
goto done;
|
||||
}
|
||||
#endif /* defined(_AIX) */
|
||||
|
||||
iovmax = uv__getiovmax();
|
||||
if (req->nbufs > iovmax)
|
||||
req->nbufs = iovmax;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user