[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] [PATCH] Fix display_string construction to handle new XDisplayStrin
From: |
anthony |
Subject: |
[RP] [PATCH] Fix display_string construction to handle new XDisplayString() behaviour |
Date: |
Wed, 20 Apr 2011 13:18:02 +0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
XDisplayString does not append ".screen number" to return value after
http://gitorious.org/omcfadde/libx11/commit/f92e754297ec5fdb81068b56a4435026666224fa
Fix by appending .screen_num to the end of s->display_string in such case
---
There should be enough space to apeend .screen_num since we allocate
strlen(XDisplayString + 21) and strlen(DISPLAY=) is only 8.
What 21 is, by the way? Is it the Ultimate Answer to the Ultimate Question of
Life, The Universe, and Everything divided by 2?
src/screen.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/screen.c b/src/screen.c
index f26f036..00fc7d1 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -283,8 +283,17 @@ init_screen (rp_screen *s, int screen_num)
char *dot;
dot = strrchr(s->display_string, '.');
- if (dot && strlen (dot) < strlen (colon))
- sprintf(dot, ".%i", screen_num);
+ if (!dot || (strlen(dot) > strlen (colon)) )
+ {
+ //no dot was found or it belongs to fqdn - append screen_num
+ //to the end
+ dot = s->display_string + strlen (s->display_string);
+ }
+ sprintf(dot, ".%i", screen_num);
+ }
+ else
+ {
+ fprintf (stderr, "Warning: failed to construct display string\n");
}
PRINT_DEBUG (("display string: %s\n", s->display_string));
--
1.7.4.1
signature.asc
Description: Digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [RP] [PATCH] Fix display_string construction to handle new XDisplayString() behaviour,
anthony <=