X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/0b5538bd8587cfa6a9c90ff7d0c4699654dbabc6..9c2d888b35db9a941e83e859a548b928ccead5f0:/src/xsmfns.c diff --git a/src/xsmfns.c b/src/xsmfns.c index 4285dd7671..a862a07c8e 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -1,6 +1,6 @@ /* Session management module for systems which understand the X Session management protocol. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -45,18 +45,13 @@ Boston, MA 02110-1301, USA. */ #include #include +#include "lisp.h" #include "systime.h" #include "sysselect.h" -#include "lisp.h" #include "termhooks.h" #include "termopts.h" #include "xterm.h" -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif /* not MAXPATHLEN */ - - /* The user login name. */ extern Lisp_Object Vuser_login_name; @@ -205,7 +200,7 @@ smc_save_yourself_CB (smcConn, int val_idx = 0; int props_idx = 0; - char cwd[MAXPATHLEN+1]; + char *cwd = NULL; char *smid_opt; /* How to start a new instance of Emacs. */ @@ -259,12 +254,9 @@ smc_save_yourself_CB (smcConn, props[props_idx]->vals[0].value = SDATA (Vuser_login_name); ++props_idx; - /* The current directory property, not mandatory. */ -#ifdef HAVE_GETCWD - if (getcwd (cwd, MAXPATHLEN+1) != 0) -#else - if (getwd (cwd) != 0) -#endif + cwd = get_current_dir_name (); + + if (cwd) { props[props_idx] = &prop_ptr[props_idx]; props[props_idx]->name = SmCurrentDirectory; @@ -281,6 +273,9 @@ smc_save_yourself_CB (smcConn, xfree (smid_opt); + if (cwd) + free (cwd); + /* See if we maybe shall interact with the user. */ if (interactStyle != SmInteractStyleAny || ! shutdown