start: refactor match_stdfds()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-07-06 01:10:13 +02:00
parent 5e64d01b6c
commit ec1dc63394
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -208,9 +208,9 @@ static bool lxc_try_preserve_namespaces(struct lxc_handler *handler,
return true;
}
static int match_fd(int fd)
static inline bool match_stdfds(int fd)
{
return (fd == 0 || fd == 1 || fd == 2);
return (fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO);
}
int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
@ -277,7 +277,7 @@ restart:
if (current_config && fd == current_config->logfd)
continue;
if (match_fd(fd))
if (match_stdfds(fd))
continue;
if (closeall) {