[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28708: 27.0.50; [PATCH] Fix search for ~/.Xdefaults-HOSTNAME
From: |
Johan Bockgård |
Subject: |
bug#28708: 27.0.50; [PATCH] Fix search for ~/.Xdefaults-HOSTNAME |
Date: |
Wed, 04 Oct 2017 23:44:31 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Emacs is supposed to look for X resources in ~/.Xdefaults-HOSTNAME, but
the code forgets the hyphen in the filename.
The bug was introduced in Emacs 25.1, by commit
1e6879dbdb0832427f5c588c89a53a8a80768a00:
2014-12-25 Paul Eggert <eggert@cs.ucla.edu>
Prefer stpcpy to strcat ...
**
The patch (should this go in the emacs-26 branch?):
diff --git a/src/xrdb.c b/src/xrdb.c
index 15a0147..3c1bad1 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -345,6 +345,7 @@ get_user_db (Display *display)
db = XrmGetStringDatabase (xdefs);
else
{
+ /* Use ~/.Xdefaults. */
char *home = gethomedir ();
ptrdiff_t homelen = strlen (home);
char *filename = xrealloc (home, homelen + sizeof xdefaults);
@@ -375,13 +376,15 @@ get_environ_db (void)
if (!p)
{
+ /* Use ~/.Xdefaults-HOSTNAME. */
char *home = gethomedir ();
ptrdiff_t homelen = strlen (home);
Lisp_Object system_name = Fsystem_name ();
ptrdiff_t filenamesize = (homelen + sizeof xdefaults
- + SBYTES (system_name));
+ + 1 + SBYTES (system_name));
p = filename = xrealloc (home, filenamesize);
- lispstpcpy (stpcpy (filename + homelen, xdefaults), system_name);
+ lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"),
+ system_name);
}
db = XrmGetFileDatabase (p);
- bug#28708: 27.0.50; [PATCH] Fix search for ~/.Xdefaults-HOSTNAME,
Johan Bockgård <=