diff --git a/io.c b/io.c index 253690b42d..b0518c1b71 100644 --- a/io.c +++ b/io.c @@ -379,10 +379,9 @@ wsplit_p(OpenFile *fptr) if (!(fptr->mode & FMODE_WSPLIT_INITIALIZED)) { struct stat buf; if (fstat(fptr->fd, &buf) == 0 && - !(S_ISREG(buf.st_mode) || - S_ISDIR(buf.st_mode)) + !S_ISREG(buf.st_mode) #if defined(HAVE_FCNTL) && defined(F_GETFL) && defined(O_NONBLOCK) - && (r = fcntl(fileno(f), F_GETFL)) != -1 && + && (r = fcntl(fptr->fd, F_GETFL)) != -1 && !(r & O_NONBLOCK) #endif ) {