]> code.delx.au - gnu-emacs/blobdiff - src/xsmfns.c
Merge from emacs-24; up to 2014-07-27T01:00:26Z!fgallina@gnu.org
[gnu-emacs] / src / xsmfns.c
index fe2dfbaf83e4b51b5f375e120a72fc7c82adfbc6..cd4f9ce57fa9d5aa008cf492399b73b3d10ac5bc 100644 (file)
@@ -1,7 +1,7 @@
 /* Session management module for systems which understand the X Session
    management protocol.
 
-Copyright (C) 2002-2013 Free Software Foundation, Inc.
+Copyright (C) 2002-2014 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -49,7 +49,7 @@ static struct input_event emacs_event;
 
 /* The descriptor that we use to check for data from the session manager.  */
 
-static int ice_fd;
+static int ice_fd = -1;
 
 /* A flag that says if we are in shutdown interactions or not.  */
 
@@ -107,8 +107,7 @@ x_session_check_input (int fd, void *data)
      will be called.  */
   emacs_event.kind = NO_EVENT;
 
-  ret = IceProcessMessages (SmcGetIceConnection (smc_conn),
-                            (IceReplyWaitInfo *)0, (Bool *)0);
+  ret = IceProcessMessages (SmcGetIceConnection (smc_conn), 0, 0);
   if (ret != IceProcessMessagesSuccess)
     {
       /* Either IO error or Connection closed.  */
@@ -396,7 +395,7 @@ x_session_initialize (struct x_display_info *dpyinfo)
 {
 #define SM_ERRORSTRING_LEN 512
   char errorstring[SM_ERRORSTRING_LEN];
-  charprevious_id = NULL;
+  char *previous_id = NULL;
   SmcCallbacks callbacks;
   ptrdiff_t name_len = 0;
 
@@ -416,11 +415,11 @@ x_session_initialize (struct x_display_info *dpyinfo)
   /* This malloc will not be freed, but it is only done once, and hopefully
      not very large   */
   emacs_program = xmalloc (name_len + 1);
-  emacs_program[0] = '\0';
+  char *z = emacs_program;
 
   if (! EQ (Vinvocation_directory, Qnil))
-    strcpy (emacs_program, SSDATA (Vinvocation_directory));
-  strcat (emacs_program, SSDATA (Vinvocation_name));
+    z = lispstpcpy (z, Vinvocation_directory);
+  lispstpcpy (z, Vinvocation_name);
 
   /* The SM protocol says all callbacks are mandatory, so set up all
      here and in the mask passed to SmcOpenConnection.  */
@@ -514,9 +513,11 @@ Do not call this function yourself. */)
          prevent.  Fix this in next version.  */
       Fkill_emacs (Qnil);
 
+#if 0
       /* This will not be reached, but we want kill-emacs-hook to be run.  */
       SmcCloseConnection (smc_conn, 0, 0);
       ice_connection_closed ();
+#endif
     }
 
   return Qnil;