[CRIU] [PATCH 5/5] util: don't ignore standard descriptors

Andrey Vagin avagin at openvz.org
Thu Jul 2 02:47:11 PDT 2015


It's rudiment. close_old_fds() closes all extra descriptors.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 util.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/util.c b/util.c
index e83f0b8..7f2887e 100644
--- a/util.c
+++ b/util.c
@@ -119,17 +119,9 @@ int reopen_fd_as_safe(char *file, int line, int new_fd, int old_fd, bool allow_r
 
 		if (!allow_reuse_fd) {
 			if (fcntl(new_fd, F_GETFD) != -1 || errno != EBADF) {
-				if (new_fd < 3) {
-					/*
-					 * Standard descriptors.
-					 */
-					pr_warn("fd %d already in use (called at %s:%d)\n",
-						new_fd, file, line);
-				} else {
-					pr_err("fd %d already in use (called at %s:%d)\n",
-						new_fd, file, line);
-					return -1;
-				}
+				pr_err("fd %d already in use (called at %s:%d)\n",
+					new_fd, file, line);
+				return -1;
 			}
 		}
 
-- 
2.1.0



More information about the CRIU mailing list