]> xenbits.xensource.com Git - libvirt.git/commitdiff
virExec: fix logic bug
authorEric Blake <eblake@redhat.com>
Fri, 24 Dec 2010 15:40:42 +0000 (08:40 -0700)
committerEric Blake <eblake@redhat.com>
Fri, 31 Dec 2010 17:12:10 +0000 (10:12 -0700)
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.

src/util/util.c

index d6fa81b4af83005cc80406bf0caa53d5e908733b..197c57126c10eab4a939f7b9d9226423ab73793d 100644 (file)
@@ -570,7 +570,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))) {
             tmpfd = i;
             VIR_FORCE_CLOSE(tmpfd);
         }