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);
{
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;
#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);