tree-wide: make macros for converting fds to pointers and back generic and use them everywhere

This commit is contained in:
Lennart Poettering
2015-11-17 00:52:10 +01:00
parent b16fee15ff
commit 23e096cc60
6 changed files with 22 additions and 23 deletions
+4
View File
@@ -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[]);