Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ebe084c140192657f9094e135a84202c > files > 147

libvirt-0.8.2-29.el5.src.rpm

From 53ad463636461a07acb8bac5ff4438ce734d52fe Mon Sep 17 00:00:00 2001
Message-Id: <53ad463636461a07acb8bac5ff4438ce734d52fe.1294149299.git.jdenemar@redhat.com>
From: Eric Blake <eblake@redhat.com>
Date: Fri, 24 Dec 2010 09:52:07 -0700
Subject: [PATCH] virExec: fix logic bug

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=665549

As pointed out in https://bugzilla.redhat.com/show_bug.cgi?id=659855#c9,
commit c3568ec2 introduced a regression where we no longer close any
fd's beyond FD_SETSIZE.

* src/util/util.c (__virExec): Continue to close fd's beyond
keepfd range.
Reported by Stefan Praszalowicz.
(cherry picked from commit e80ed3fd3bd6d6d100b46f06474b8cb8406cdfc5)

Conflicts:

	src/util/util.c
---
 src/util/util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/util.c b/src/util/util.c
index 08805ae..40d7572 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -569,7 +569,7 @@ __virExec(const char *const*argv,
             i != null &&
             i != childout &&
             i != childerr &&
-            (!keepfd || (i < FD_SETSIZE && !FD_ISSET(i, keepfd))))
+            (!keepfd || i >= FD_SETSIZE || !FD_ISSET(i, keepfd)))
             close(i);
 
     if (dup2(infd >= 0 ? infd : null, STDIN_FILENO) < 0) {
-- 
1.7.3.4