fd_util: removed creat_cloexec()

Add a "mode" argument to open_cloexec() instead.
This commit is contained in:
Max Kellermann
2009-11-10 16:53:24 +01:00
parent 3d2a9d3545
commit e0e6813a1d
9 changed files with 13 additions and 39 deletions

View File

@@ -101,7 +101,7 @@ fd_set_nonblock(int fd)
}
int
open_cloexec(const char *path_fs, int flags)
open_cloexec(const char *path_fs, int flags, int mode)
{
int fd;
@@ -109,26 +109,6 @@ open_cloexec(const char *path_fs, int flags)
flags |= O_CLOEXEC;
#endif
#ifdef O_NOCTTY
flags |= O_NOCTTY;
#endif
fd = open(path_fs, flags, 0666);
fd_set_cloexec(fd, true);
return fd;
}
int
creat_cloexec(const char *path_fs, int mode)
{
int flags = O_CREAT|O_WRONLY|O_TRUNC;
int fd;
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
#ifdef O_NOCTTY
flags |= O_NOCTTY;
#endif