From: Christian Brauner Date: Thu, 5 Jul 2018 23:10:13 +0000 (+0200) Subject: start: refactor match_stdfds() X-Git-Tag: lxc-3.1.0~217^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec1dc633944469682a63148940acca0ea79e86c4;p=thirdparty%2Flxc.git start: refactor match_stdfds() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/start.c b/src/lxc/start.c index 953722261..a13b56d9c 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -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) {