From 146bb9b2c19fb75b7629b65d5871969b7fcef97a Mon Sep 17 00:00:00 2001 From: Ilya Pominov Date: Mon, 10 Apr 2023 18:52:25 +0300 Subject: [PATCH] RandR: Allow duplicate monitor name when adding it When calling RRSetMonitor, an existing monitor name is allowed. "If 'name' matches an existing Monitor on the screen, the existing one will be deleted as if RRDeleteMonitor were called." https://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt It looks like the check was added by mistake, because in the next 'for' the monitor is deleted if it is in this list. Steps to reproduce: Try RRSetMonitor with existing monitor name and other valid params OBSERVED RESULT: RRSetMonitors returns BadValue EXPECTED RESULT: RRSetMonitors returns OK Amend: 7e1f86d42b54fb7f6492875e47a718eaeca3069b Signed-off-by: Ilya Pominov --- randr/rrmonitor.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/randr/rrmonitor.c b/randr/rrmonitor.c index 7b0bbfcd5..c905042bb 100644 --- a/randr/rrmonitor.c +++ b/randr/rrmonitor.c @@ -489,17 +489,6 @@ RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor) } } - /* 'name' must not match the name of any Monitor on the screen, or - * a Value error results. - */ - - for (m = 0; m < pScrPriv->numMonitors; m++) { - if (pScrPriv->monitors[m]->name == monitor->name) { - client->errorValue = monitor->name; - return BadValue; - } - } - /* Allocate space for the new pointer. This is done before * removing matching monitors as it may fail, and the request * needs to not have any side-effects on failure