* xterm.c (x_term_init): Build proper-sized _XSETTINGS_Snnn string
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 24 Jun 2012 23:14:39 +0000 (16:14 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 24 Jun 2012 23:14:39 +0000 (16:14 -0700)
instead of truncating it to 63 (admittedly a generous limit).

src/ChangeLog
src/xterm.c

index 66ca8a3..7878a4d 100644 (file)
@@ -1,5 +1,8 @@
 2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * xterm.c (x_term_init): Build proper-sized _XSETTINGS_Snnn string
+       instead of truncating it to 63 (admittedly a generous limit).
+
        * process.c: Fix spelling and caps in comments.
 
 2012-06-24  Dan Nicolaescu  <dann@ics.uci.edu>
index 9587a47..f398e4d 100644 (file)
@@ -10375,14 +10375,16 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
     const int total_atom_count = 1 + atom_count;
     Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count);
     char **atom_names = xmalloc (sizeof (char *) * total_atom_count);
-    char xsettings_atom_name[64];
+    static char const xsettings_fmt[] = "_XSETTINGS_S%d";
+    char xsettings_atom_name[sizeof xsettings_fmt - 2
+                            + INT_STRLEN_BOUND (int)];
 
     for (i = 0; i < atom_count; i++)
       atom_names[i] = (char *) atom_refs[i].name;
 
     /* Build _XSETTINGS_SN atom name */
-    snprintf (xsettings_atom_name, sizeof (xsettings_atom_name),
-              "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen));
+    sprintf (xsettings_atom_name, xsettings_fmt,
+            XScreenNumberOfScreen (dpyinfo->screen));
     atom_names[i] = xsettings_atom_name;
 
     XInternAtoms (dpyinfo->display, atom_names, total_atom_count,