[libvirt] Fix stream operations like screenshot (bz #960879)
Cole Robinson
crobinso at fedoraproject.org
Tue May 14 21:32:12 UTC 2013
commit 45c1cabef65daaf0d500df360a46f192ca82eafc
Author: Cole Robinson <crobinso at redhat.com>
Date: Tue May 14 17:32:09 2013 -0400
Fix stream operations like screenshot (bz #960879)
...helper-usage-with-streams-opened-for-read.patch | 34 ++++++++++++++++++++
libvirt.spec | 9 +++++-
2 files changed, 42 insertions(+), 1 deletions(-)
---
diff --git a/0002-Fix-iohelper-usage-with-streams-opened-for-read.patch b/0002-Fix-iohelper-usage-with-streams-opened-for-read.patch
new file mode 100644
index 0000000..622dafd
--- /dev/null
+++ b/0002-Fix-iohelper-usage-with-streams-opened-for-read.patch
@@ -0,0 +1,34 @@
+From a2214c5257d3bd7b086ce04aca1648e8ff05ee96 Mon Sep 17 00:00:00 2001
+Message-Id: <a2214c5257d3bd7b086ce04aca1648e8ff05ee96.1368567003.git.crobinso at redhat.com>
+From: "Daniel P. Berrange" <berrange at redhat.com>
+Date: Fri, 10 May 2013 14:45:05 +0100
+Subject: [PATCH] Fix iohelper usage with streams opened for read
+
+In b2878ed860ceceec3cd6481424fed0b543b687cd we added the O_NOCTTY
+flag when opening files in the stream code. Unfortunately a later
+piece of code was comparing the flags == O_RDONLY, without masking
+out the non-access mode flags. This broke the iohelper when used
+with streams for read, since it caused us to attach the stream
+output pipe to the stream input FD instead of output FD :-(
+
+Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
+---
+ src/fdstream.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/fdstream.c b/src/fdstream.c
+index 6f8ce53..a9a4851 100644
+--- a/src/fdstream.c
++++ b/src/fdstream.c
+@@ -641,7 +641,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
+ virCommandTransferFD(cmd, fd);
+ virCommandAddArgFormat(cmd, "%d", fd);
+
+- if (oflags == O_RDONLY) {
++ if ((oflags & O_ACCMODE) == O_RDONLY) {
+ childfd = fds[1];
+ fd = fds[0];
+ virCommandSetOutputFD(cmd, &childfd);
+--
+1.8.2.1
+
diff --git a/libvirt.spec b/libvirt.spec
index 671cf83..0acf734 100644
--- a/libvirt.spec
+++ b/libvirt.spec
@@ -341,7 +341,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 1.0.5
-Release: 2%{?dist}%{?extra_release}
+Release: 3%{?dist}%{?extra_release}
License: LGPLv2+
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@@ -353,6 +353,8 @@ URL: http://libvirt.org/
Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz
Patch1: libvirt-1.0.5-fix-network-driver-startup-qemu-session.patch
+# Fix stream operations like screenshot (bz #960879)
+Patch0002: 0002-Fix-iohelper-usage-with-streams-opened-for-read.patch
%if %{with_libvirtd}
Requires: libvirt-daemon = %{version}-%{release}
@@ -1084,6 +1086,8 @@ of recent versions of Linux (and other OSes).
%prep
%setup -q
%patch1 -p1
+# Fix stream operations like screenshot (bz #960879)
+%patch0002 -p1
%build
%if ! %{with_xen}
@@ -2001,6 +2005,9 @@ fi
%endif
%changelog
+* Tue May 14 2013 Cole Robinson <crobinso at redhat.com> - 1.0.5-3
+- Fix stream operations like screenshot (bz #960879)
+
* Fri May 3 2013 Richard W.M. Jones <rjones at redhat.com> - 1.0.5-2
- Fix network driver when using qemu:///session (bz #958907).
More information about the scm-commits
mailing list