uicb: check before overwriting DISPLAY (FS#318)

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Nikos Ntarmos 2009-03-15 09:50:56 +01:00 committed by Julien Danjou
parent 2a82b09a73
commit bc2e7cde15
1 changed files with 2 additions and 1 deletions

3
uicb.c
View File

@ -110,10 +110,11 @@ uicb_spawn(int screen, char *arg)
if(!globalconf.screens_info->xinerama_is_active && (tmp = getenv("DISPLAY")))
{
display = a_strdup(tmp);
if((tmp = strrchr(display, '.')))
if ((tmp = strrchr(display, '.')) && !strchr(tmp, ':'))
*tmp = '\0';
snprintf(newdisplay, sizeof(newdisplay), "%s.%d", display, screen);
setenv("DISPLAY", newdisplay, 1);
p_delete(&display);
}