diff options
author | Glenn Morris <rgm@gnu.org> | 2015-06-13 16:35:54 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2015-06-13 16:35:54 -0700 |
commit | 9bdd1c4c90bc19904f63361c32ebd4304f038aaf (patch) | |
tree | 283710df50ee1a71c41e9811814f345c3a171d66 | |
parent | 8afef016e2bc413c7a4913554ea6ed2c55474de6 (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.c | 9 |
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; |