fd-close-on-exec.c revision cca4ba2a504d70a9fe9fee37f8433997359de52c
#include "lib.h"
#include "net.h"
#include "fd-close-on-exec.h"
#include <unistd.h>
#include <fcntl.h>
{
int flags;
if (flags < 0)
}
{
int old_errno;
continue;
struct sockaddr_un sa;
&socklen) < 0)
i_panic("Leaked UNIX socket fd %d: %s",
}
rport = 0;
}
i_panic("Leaked socket fd %d: %s:%u -> %s:%u",
}
#ifdef __APPLE__
/* OSX workaround: gettimeofday() calls shm_open()
internally and the fd won't get closed on exec.
weren't anything else. */
continue;
#endif
#ifdef HAVE_SYS_SYSMACROS_H
i_panic("Leaked file fd %d: dev %s.%s inode %s",
#else
i_panic("Leaked file fd %d: dev %s inode %s",
#endif
}
i_panic("Leaked unknown fd %d (errno = %s)",
}
}