summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2015-06-13 16:35:54 -0700
committerGlenn Morris <rgm@gnu.org>2015-06-13 16:35:54 -0700
commit9bdd1c4c90bc19904f63361c32ebd4304f038aaf (patch)
tree283710df50ee1a71c41e9811814f345c3a171d66
parent8afef016e2bc413c7a4913554ea6ed2c55474de6 (diff)
* src/xsmfns.c (x_session_initialize): Avoid libSM crash
when starup directory is missing. (Bug#18851) (errno.h): Include it.
-rw-r--r--src/xsmfns.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 48aaa9bef8..3b06f7133c 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <sys/param.h>
+#include <errno.h>
#include <stdio.h>
#include "lisp.h"
@@ -402,6 +403,14 @@ x_session_initialize (struct x_display_info *dpyinfo)
SmcCallbacks callbacks;
ptrdiff_t name_len = 0;
+ /* libSM seems to crash if pwd is missing - see bug#18851. */
+ if (! get_current_dir_name ())
+ {
+ fprintf (stderr, "Disabling session management due to pwd error: %s\n",
+ emacs_strerror (errno));
+ return;
+ }
+
ice_fd = -1;
doing_interact = false;