Re: [libvirt] [PATCH 1/4] util: Allow virProcessSetNamespaces() to have sparse FD list

2015-08-27 Thread Daniel P. Berrange
On Thu, Aug 27, 2015 at 03:06:51AM +0200, Michal Privoznik wrote:
 So far, the virProcessSetNamespaces() takes an array of FDs that
 it tries to set namespace on. However, in the very next commit
 this array may be sparse, having some -1's in it. Teach the
 function to cope with that.
 
 Signed-off-by: Michal Privoznik mpriv...@redhat.com
 ---
  src/util/virprocess.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/src/util/virprocess.c b/src/util/virprocess.c
 index 77a038a..e6b78ef 100644
 --- a/src/util/virprocess.c
 +++ b/src/util/virprocess.c
 @@ -705,6 +705,9 @@ int virProcessSetNamespaces(size_t nfdlist,
  return -1;
  }
  for (i = 0; i  nfdlist; i++) {
 +if (fdlist[i]  0)
 +continue;
 +
  /* We get EINVAL if new NS is same as the current
   * NS, or if the fd namespace doesn't match the
   * type passed to setns()'s second param. Since we

ACK

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/4] util: Allow virProcessSetNamespaces() to have sparse FD list

2015-08-26 Thread Michal Privoznik
So far, the virProcessSetNamespaces() takes an array of FDs that
it tries to set namespace on. However, in the very next commit
this array may be sparse, having some -1's in it. Teach the
function to cope with that.

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 src/util/virprocess.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 77a038a..e6b78ef 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -705,6 +705,9 @@ int virProcessSetNamespaces(size_t nfdlist,
 return -1;
 }
 for (i = 0; i  nfdlist; i++) {
+if (fdlist[i]  0)
+continue;
+
 /* We get EINVAL if new NS is same as the current
  * NS, or if the fd namespace doesn't match the
  * type passed to setns()'s second param. Since we
-- 
2.4.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list