diff options
Diffstat (limited to 'compat/nonblock.c')
| -rw-r--r-- | compat/nonblock.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/compat/nonblock.c b/compat/nonblock.c new file mode 100644 index 0000000000..b08105a21d --- /dev/null +++ b/compat/nonblock.c @@ -0,0 +1,23 @@ +#include "git-compat-util.h" +#include "nonblock.h" + +#ifdef O_NONBLOCK + +int enable_pipe_nonblock(int fd) +{ + int flags = fcntl(fd, F_GETFL); + if (flags < 0) + return -1; + flags |= O_NONBLOCK; + return fcntl(fd, F_SETFL, flags); +} + +#else + +int enable_pipe_nonblock(int fd) +{ + errno = ENOSYS; + return -1; +} + +#endif |
