Add cloexec() and xfree() to libroken

This commit is contained in:
Asanka Herath
2009-08-26 14:41:58 -04:00
committed by Love Hornquist Astrand
parent 5dd6355e56
commit 7ee1695f12
3 changed files with 7 additions and 6 deletions

View File

@@ -37,6 +37,7 @@ libroken_la_OBJS = \
$(OBJ)\base64.obj \
$(OBJ)\bswap.obj \
$(OBJ)\concat.obj \
$(OBJ)\cloexec.obj \
$(OBJ)\dirent.obj \
$(OBJ)\dlfcn_w32.obj \
$(OBJ)\dumpdata.obj \
@@ -102,7 +103,8 @@ libroken_la_OBJS = \
$(OBJ)\vwarnx.obj \
$(OBJ)\warn.obj \
$(OBJ)\warnerr.obj \
$(OBJ)\warnx.obj
$(OBJ)\warnx.obj \
$(OBJ)\xfree.obj
{}.c{$(OBJ)}.obj:
$(C2OBJ) -DBUILD_ROKEN_LIB

View File

@@ -33,14 +33,12 @@
#include <config.h>
#include <unistd.h>
#include <fcntl.h>
#include "roken.h"
void ROKEN_LIB_FUNCTION
rk_cloexec(int fd)
{
#ifdef HAVE_FCNTL
int ret;
ret = fcntl(fd, F_GETFD);
@@ -48,10 +46,13 @@ rk_cloexec(int fd)
return;
if (fcntl(fd, F_SETFD, ret | FD_CLOEXEC) == -1)
return;
#endif
}
void ROKEN_LIB_FUNCTION
rk_cloexec_file(FILE *f)
{
#ifdef HAVE_FCNTL
rk_cloexec(fileno(f));
#endif
}

View File

@@ -33,8 +33,6 @@
#include <config.h>
#include <unistd.h>
#include "roken.h"
void ROKEN_LIB_FUNCTION