* src/xsmfns.c (x_session_initialize): Avoid libSM crash

when starup directory is missing.  (Bug#18851)
(errno.h): Include it.
This commit is contained in:
Glenn Morris 2015-06-13 16:35:54 -07:00
parent 8afef016e2
commit 9bdd1c4c90

View file

@ -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;