about summary refs log tree commit diff
path: root/src/misc
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/isastream.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/misc/isastream.c b/src/misc/isastream.c
new file mode 100644
index 00000000..4dafdb08
--- /dev/null
+++ b/src/misc/isastream.c
@@ -0,0 +1,7 @@
+#include <stropts.h>
+#include <fcntl.h>
+
+int isastream(int fd)
+{
+	return fcntl(fd, F_GETFD) < 0 ? -1 : 0;
+}