daemon: Minor code reorganization.
This commit is contained in:
parent
0333c74bec
commit
ec8ac2f258
3 changed files with 17 additions and 14 deletions
|
@ -57,6 +57,18 @@ int clear_nonblock(int fd)
|
|||
return r;
|
||||
}
|
||||
|
||||
int set_cloexec(int fd)
|
||||
{
|
||||
int fdflags;
|
||||
|
||||
if ((fdflags = fcntl(fd, F_GETFD)) == -1)
|
||||
fdflags = 0;
|
||||
if (fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC) == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int open_stdio_pty(stdio_pty_t *stdiopty)
|
||||
{
|
||||
int masterfd, slavefd;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue