closeexec.c (280B)
1 /* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail> 2 * See LICENSE file for license details. 3 */ 4 #include <unistd.h> 5 #include <fcntl.h> 6 #include "util.h" 7 8 void 9 closeexec(int fd) { 10 if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) 11 fatal("can't set %d close on exec: %r", fd); 12 }