Don't leak descriptors to sendmail

This commit is contained in:
Miroslav Lichvar
2011-01-18 18:07:46 +01:00
parent 59c68d240c
commit 9d35b5deac
9 changed files with 38 additions and 0 deletions

14
util.c
View File

@@ -600,3 +600,17 @@ UTI_FloatHostToNetwork(double x)
}
/* ================================================== */
void
UTI_FdSetCloexec(int fd)
{
int flags;
flags = fcntl(fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
fcntl(fd, F_SETFD, flags);
}
}
/* ================================================== */