check for matching '/' in screen edid before fuzzy matching in randr init

if no / exists then this function is pointless
This commit is contained in:
Mike Blumenkrantz 2017-09-01 13:40:12 -04:00
parent 12fc4286a6
commit b4574be2bc
1 changed files with 5 additions and 3 deletions

View File

@ -685,9 +685,11 @@ _screen_fuzzy_fallback_find(E_Config_Randr2 *cfg, const char *id)
// strip out everythng in the string from / on as that is edid
// and fall back to finding just the output name in the rel
// to identifier, rather than the specific screen id
name = alloca(strlen(id) + 1);
strcpy(name, id);
if ((p = strchr(name, '/'))) *p = 0;
p = strchr(id, '/');
if (!p) return NULL;
name = alloca((p - id) + 1);
strncpy(name, id, p - id);
name[p - id] = 0;
s = _screen_id_find(id);
if (!s) s = _screen_output_find(name);