summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util/util.h b/src/util/util.h
index 11054c106..b4ab14e71 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -84,6 +84,20 @@
#define FLAGS_INTERACTIVE 0x0002
#define FLAGS_PID_FILE 0x0004
+#define PIPE_INIT { -1, -1 }
+
+#define PIPE_FD_CLOSE(fd) do { \
+ if (fd != -1) { \
+ close(fd); \
+ fd = -1; \
+ } \
+} while(0);
+
+#define PIPE_CLOSE(p) do { \
+ PIPE_FD_CLOSE(p[0]); \
+ PIPE_FD_CLOSE(p[1]); \
+} while(0);
+
#ifndef talloc_zfree
#define talloc_zfree(ptr) do { talloc_free(discard_const(ptr)); ptr = NULL; } while(0)
#endif