summaryrefslogtreecommitdiff
path: root/src/basic/fd-util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/fd-util.h')
-rw-r--r--src/basic/fd-util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
index 1ca10f0383..0e9182d75b 100644
--- a/src/basic/fd-util.h
+++ b/src/basic/fd-util.h
@@ -28,6 +28,10 @@
#include "macro.h"
+/* Make sure we can distinguish fd 0 and NULL */
+#define FD_TO_PTR(fd) INT_TO_PTR((fd)+1)
+#define PTR_TO_FD(p) (PTR_TO_INT(p)-1)
+
int close_nointr(int fd);
int safe_close(int fd);
void safe_close_pair(int p[]);