mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-02 08:22:22 +00:00
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
19
src/xrdb.c
19
src/xrdb.c
@ -376,15 +376,18 @@ 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
|
||||
+ 1 + SBYTES (system_name));
|
||||
p = filename = xrealloc (home, filenamesize);
|
||||
lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"),
|
||||
system_name);
|
||||
if (STRINGP (system_name))
|
||||
{
|
||||
/* Use ~/.Xdefaults-HOSTNAME. */
|
||||
char *home = gethomedir ();
|
||||
ptrdiff_t homelen = strlen (home);
|
||||
ptrdiff_t filenamesize = (homelen + sizeof xdefaults
|
||||
+ 1 + SBYTES (system_name));
|
||||
p = filename = xrealloc (home, filenamesize);
|
||||
lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"),
|
||||
system_name);
|
||||
}
|
||||
}
|
||||
|
||||
db = XrmGetFileDatabase (p);
|
||||
|
16
src/xterm.c
16
src/xterm.c
@ -12150,6 +12150,8 @@ same_x_server (const char *name1, const char *name2)
|
||||
{
|
||||
bool seen_colon = false;
|
||||
Lisp_Object sysname = Fsystem_name ();
|
||||
if (! STRINGP (sysname))
|
||||
sysname = empty_unibyte_string;
|
||||
const char *system_name = SSDATA (sysname);
|
||||
ptrdiff_t system_name_length = SBYTES (sysname);
|
||||
ptrdiff_t length_until_period = 0;
|
||||
@ -12572,15 +12574,19 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
||||
#endif
|
||||
|
||||
Lisp_Object system_name = Fsystem_name ();
|
||||
ptrdiff_t nbytes;
|
||||
if (INT_ADD_WRAPV (SBYTES (Vinvocation_name), SBYTES (system_name) + 2,
|
||||
&nbytes))
|
||||
|
||||
ptrdiff_t nbytes = SBYTES (Vinvocation_name) + 1;
|
||||
if (STRINGP (system_name)
|
||||
&& INT_ADD_WRAPV (nbytes, SBYTES (system_name) + 1, &nbytes))
|
||||
memory_full (SIZE_MAX);
|
||||
dpyinfo->x_id = ++x_display_id;
|
||||
dpyinfo->x_id_name = xmalloc (nbytes);
|
||||
char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name);
|
||||
*nametail++ = '@';
|
||||
lispstpcpy (nametail, system_name);
|
||||
if (STRINGP (system_name))
|
||||
{
|
||||
*nametail++ = '@';
|
||||
lispstpcpy (nametail, system_name);
|
||||
}
|
||||
|
||||
/* Figure out which modifier bits mean what. */
|
||||
x_find_modifier_meanings (dpyinfo);
|
||||
|
Loading…
Reference in New Issue
Block a user