Skip to content

Commit

Permalink
utils: set_stdfds()
Browse files Browse the repository at this point in the history
non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jul 10, 2017
1 parent c5b93af commit bbbf65e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/lxc/utils.c
Expand Up @@ -1822,14 +1822,21 @@ int open_devnull(void)

int set_stdfds(int fd)
{
int ret;

if (fd < 0)
return -1;

if (dup2(fd, 0) < 0)
ret = dup2(fd, STDIN_FILENO);
if (ret < 0)
return -1;
if (dup2(fd, 1) < 0)

ret = dup2(fd, STDOUT_FILENO);
if (ret < 0)
return -1;
if (dup2(fd, 2) < 0)

ret = dup2(fd, STDERR_FILENO);
if (ret < 0)
return -1;

return 0;
Expand Down

0 comments on commit bbbf65e

Please sign in to comment.