Fix crashes when run with --no-build-details
* src/xrdb.c (get_environ_db): * src/xterm.c (same_x_server, x_term_init): Don’t assume Fsystem_name returns a string.
This commit is contained in:
parent
dc08490ac7
commit
c2727e3c40
2 changed files with 22 additions and 13 deletions
|
@ -375,17 +375,20 @@ get_environ_db (void)
|
||||||
char *filename = 0;
|
char *filename = 0;
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
|
{
|
||||||
|
Lisp_Object system_name = Fsystem_name ();
|
||||||
|
if (STRINGP (system_name))
|
||||||
{
|
{
|
||||||
/* Use ~/.Xdefaults-HOSTNAME. */
|
/* Use ~/.Xdefaults-HOSTNAME. */
|
||||||
char *home = gethomedir ();
|
char *home = gethomedir ();
|
||||||
ptrdiff_t homelen = strlen (home);
|
ptrdiff_t homelen = strlen (home);
|
||||||
Lisp_Object system_name = Fsystem_name ();
|
|
||||||
ptrdiff_t filenamesize = (homelen + sizeof xdefaults
|
ptrdiff_t filenamesize = (homelen + sizeof xdefaults
|
||||||
+ 1 + SBYTES (system_name));
|
+ 1 + SBYTES (system_name));
|
||||||
p = filename = xrealloc (home, filenamesize);
|
p = filename = xrealloc (home, filenamesize);
|
||||||
lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"),
|
lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"),
|
||||||
system_name);
|
system_name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
db = XrmGetFileDatabase (p);
|
db = XrmGetFileDatabase (p);
|
||||||
|
|
||||||
|
|
12
src/xterm.c
12
src/xterm.c
|
@ -12150,6 +12150,8 @@ same_x_server (const char *name1, const char *name2)
|
||||||
{
|
{
|
||||||
bool seen_colon = false;
|
bool seen_colon = false;
|
||||||
Lisp_Object sysname = Fsystem_name ();
|
Lisp_Object sysname = Fsystem_name ();
|
||||||
|
if (! STRINGP (sysname))
|
||||||
|
sysname = empty_unibyte_string;
|
||||||
const char *system_name = SSDATA (sysname);
|
const char *system_name = SSDATA (sysname);
|
||||||
ptrdiff_t system_name_length = SBYTES (sysname);
|
ptrdiff_t system_name_length = SBYTES (sysname);
|
||||||
ptrdiff_t length_until_period = 0;
|
ptrdiff_t length_until_period = 0;
|
||||||
|
@ -12572,15 +12574,19 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Lisp_Object system_name = Fsystem_name ();
|
Lisp_Object system_name = Fsystem_name ();
|
||||||
ptrdiff_t nbytes;
|
|
||||||
if (INT_ADD_WRAPV (SBYTES (Vinvocation_name), SBYTES (system_name) + 2,
|
ptrdiff_t nbytes = SBYTES (Vinvocation_name) + 1;
|
||||||
&nbytes))
|
if (STRINGP (system_name)
|
||||||
|
&& INT_ADD_WRAPV (nbytes, SBYTES (system_name) + 1, &nbytes))
|
||||||
memory_full (SIZE_MAX);
|
memory_full (SIZE_MAX);
|
||||||
dpyinfo->x_id = ++x_display_id;
|
dpyinfo->x_id = ++x_display_id;
|
||||||
dpyinfo->x_id_name = xmalloc (nbytes);
|
dpyinfo->x_id_name = xmalloc (nbytes);
|
||||||
char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name);
|
char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name);
|
||||||
|
if (STRINGP (system_name))
|
||||||
|
{
|
||||||
*nametail++ = '@';
|
*nametail++ = '@';
|
||||||
lispstpcpy (nametail, system_name);
|
lispstpcpy (nametail, system_name);
|
||||||
|
}
|
||||||
|
|
||||||
/* Figure out which modifier bits mean what. */
|
/* Figure out which modifier bits mean what. */
|
||||||
x_find_modifier_meanings (dpyinfo);
|
x_find_modifier_meanings (dpyinfo);
|
||||||
|
|
Loading…
Add table
Reference in a new issue