start: refactor match_stdfds()

parent 5e64d01b
...@@ -208,9 +208,9 @@ static bool lxc_try_preserve_namespaces(struct lxc_handler *handler, ...@@ -208,9 +208,9 @@ static bool lxc_try_preserve_namespaces(struct lxc_handler *handler,
return true; 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, int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
...@@ -277,7 +277,7 @@ restart: ...@@ -277,7 +277,7 @@ restart:
if (current_config && fd == current_config->logfd) if (current_config && fd == current_config->logfd)
continue; continue;
if (match_fd(fd)) if (match_stdfds(fd))
continue; continue;
if (closeall) { if (closeall) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment