return error_code(errno, posix_category());
}
- // If this is a named pipe or character device, we can't trust the size.
- // Create the memory buffer by copying off the stream.
- if (S_ISFIFO(FileInfo.st_mode) || S_ISCHR(FileInfo.st_mode)) {
+ // If this not a file or a block device (e.g. it's a named pipe
+ // or character device), we can't trust the size. Create the memory
+ // buffer by copying off the stream.
+ if (!S_ISREG(FileInfo.st_mode) && !S_ISBLK(FileInfo.st_mode)) {
return getMemoryBufferForStream(FD, Filename, result);
}