daemon: Minor code reorganization.

This commit is contained in:
Tom Goff 2016-01-29 17:46:55 -05:00
parent 0333c74bec
commit ec8ac2f258
3 changed files with 17 additions and 14 deletions

View file

@ -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;