]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't send bad SM messages.
authorJan D <jhd@f20.localdomain>
Sat, 28 Mar 2015 11:33:25 +0000 (12:33 +0100)
committerJan D <jhd@f20.localdomain>
Sat, 28 Mar 2015 11:33:25 +0000 (12:33 +0100)
* xsmfns.c (smc_save_yourself_CB): Return if Vinvocation_name or
user_login_name are not strings.

src/ChangeLog
src/xsmfns.c

index 0cc0a42b3499ff2f68a9a297dfec0dccb1e38a1c..7874910c8136abf6ea3180cb1d7f80bd900ab825 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-28  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsmfns.c (smc_save_yourself_CB): Return if Vinvocation_name or
+       user_login_name are not strings.
+
 2015-03-28  Eli Zaretskii  <eliz@gnu.org>
 
        * w32.c (sys_connect): Fix a mistake in previous commit that broke
index 375b51c446623cf5b6d001feff7e74111c9c7ce2..48aaa9bef8a1870c968df49e7b18f76bea3d9f91 100644 (file)
@@ -169,6 +169,11 @@ smc_save_yourself_CB (SmcConn smcConn,
   int props_idx = 0;
   int i;
   char *smid_opt, *chdir_opt = NULL;
+  Lisp_Object user_login_name = Fuser_login_name (Qnil);
+
+  // Must have these.
+  if (! STRINGP (Vinvocation_name) || ! STRINGP (user_login_name))
+    return;
 
   /* How to start a new instance of Emacs.  */
   props[props_idx] = &prop_ptr[props_idx];
@@ -180,32 +185,25 @@ smc_save_yourself_CB (SmcConn smcConn,
   props[props_idx]->vals[0].value = emacs_program;
   ++props_idx;
 
-  if (STRINGP (Vinvocation_name))
-    {
-      /* The name of the program.  */
-      props[props_idx] = &prop_ptr[props_idx];
-      props[props_idx]->name = xstrdup (SmProgram);
-      props[props_idx]->type = xstrdup (SmARRAY8);
-      props[props_idx]->num_vals = 1;
-      props[props_idx]->vals = &values[val_idx++];
-      props[props_idx]->vals[0].length = SBYTES (Vinvocation_name);
-      props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
-      ++props_idx;
-    }
+  /* The name of the program.  */
+  props[props_idx] = &prop_ptr[props_idx];
+  props[props_idx]->name = xstrdup (SmProgram);
+  props[props_idx]->type = xstrdup (SmARRAY8);
+  props[props_idx]->num_vals = 1;
+  props[props_idx]->vals = &values[val_idx++];
+  props[props_idx]->vals[0].length = SBYTES (Vinvocation_name);
+  props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
+  ++props_idx;
 
   /* User id.  */
-  Lisp_Object user_login_name = Fuser_login_name (Qnil);
-  if (STRINGP (user_login_name))
-    {
-      props[props_idx] = &prop_ptr[props_idx];
-      props[props_idx]->name = xstrdup (SmUserID);
-      props[props_idx]->type = xstrdup (SmARRAY8);
-      props[props_idx]->num_vals = 1;
-      props[props_idx]->vals = &values[val_idx++];
-      props[props_idx]->vals[0].length = SBYTES (user_login_name);
-      props[props_idx]->vals[0].value = SDATA (user_login_name);
-      ++props_idx;
-    }
+  props[props_idx] = &prop_ptr[props_idx];
+  props[props_idx]->name = xstrdup (SmUserID);
+  props[props_idx]->type = xstrdup (SmARRAY8);
+  props[props_idx]->num_vals = 1;
+  props[props_idx]->vals = &values[val_idx++];
+  props[props_idx]->vals[0].length = SBYTES (user_login_name);
+  props[props_idx]->vals[0].value = SDATA (user_login_name);
+  ++props_idx;
 
   char *cwd = get_current_dir_name ();
   if (cwd)