From: Glenn Morris Date: Sat, 13 Jun 2015 23:35:54 +0000 (-0700) Subject: * src/xsmfns.c (x_session_initialize): Avoid libSM crash X-Git-Tag: emacs-25.0.90~1774 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9bdd1c4c90bc19904f63361c32ebd4304f038aaf;p=emacs.git * src/xsmfns.c (x_session_initialize): Avoid libSM crash when starup directory is missing. (Bug#18851) (errno.h): Include it. --- diff --git a/src/xsmfns.c b/src/xsmfns.c index 48aaa9bef8a..3b06f7133c7 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -28,6 +28,7 @@ along with GNU Emacs. If not, see . */ #include #include +#include #include #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;