Blob Blame History Raw
From 96c00ebf666e044d0b53ad569dde3c24ce7b9b4d Mon Sep 17 00:00:00 2001
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Thu, 19 Dec 2013 11:31:21 -0600
Subject: [PATCH] Don't abort if XRRSetCrtcConfig fails

In certain configurations (Fedora 20 or RHEL7 guests on a RHEL6 host), this call
fails, which cause the vdagent to abort. This patch prevents the crash, though
arbitrary resizing is obviously still non-functional in this situation.

https://bugzilla.redhat.com/show_bug.cgi?id=1066422
(cherry picked from commit 6e2e82e6fbb8927d5154f32c83e2b95c08fef18e)
---
 src/vdagent-x11-randr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
index b1f9813..46367bc 100644
--- a/src/vdagent-x11-randr.c
+++ b/src/vdagent-x11-randr.c
@@ -366,11 +366,11 @@ static int xrandr_add_and_set(struct vdagent_x11 *x11, int output, int x, int y,
     x11->randr.monitor_sizes[output].width = width;
     x11->randr.monitor_sizes[output].height = height;
     outputs[0] = xid;
+    vdagent_x11_set_error_handler(x11, error_handler);
     s = XRRSetCrtcConfig(x11->display, x11->randr.res, x11->randr.res->crtcs[output],
                          CurrentTime, x, y, mode->id, RR_Rotate_0, outputs,
                          1);
-
-    if (s != RRSetConfigSuccess) {
+    if (vdagent_x11_restore_error_handler(x11) || (s != RRSetConfigSuccess)) {
         syslog(LOG_ERR, "failed to XRRSetCrtcConfig");
         x11->set_crtc_config_not_functional = 1;
         return 0;