Skip to content

Commit ae3884d

Browse files
authored
Merge pull request #2692 from thesamesam/fifo-no-validate
Don't require a FIFO to be identifiable as such
2 parents 1272304 + 71cb2a4 commit ae3884d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/jobserver-posix.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626

2727
namespace {
2828

29-
// Return true if |fd| is a fifo or pipe descriptor.
30-
bool IsFifoDescriptor(int fd) {
29+
// Return true if |fd| is a fifo or character device.
30+
bool IsJobserverDescriptor(int fd) {
3131
struct stat info;
3232
int ret = ::fstat(fd, &info);
33-
return (ret == 0) && ((info.st_mode & S_IFMT) == S_IFIFO);
33+
return (ret == 0) && (((info.st_mode & S_IFMT) == S_IFIFO) ||
34+
((info.st_mode & S_IFMT) == S_IFCHR));
3435
}
3536

3637
// Implementation of Jobserver::Client for Posix systems
@@ -89,7 +90,7 @@ class PosixJobserverClient : public Jobserver::Client {
8990
std::string("Error opening fifo for reading: ") + strerror(errno);
9091
return false;
9192
}
92-
if (!IsFifoDescriptor(read_fd_)) {
93+
if (!IsJobserverDescriptor(read_fd_)) {
9394
*error = "Not a fifo path: " + fifo_path;
9495
// Let destructor close read_fd_.
9596
return false;

0 commit comments

Comments
 (0)