summaryrefslogtreecommitdiff
path: root/src/xsmfns.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2005-09-10 11:31:50 +0000
committerEli Zaretskii <eliz@gnu.org>2005-09-10 11:31:50 +0000
commitc187839de5677f0a6d7695647829a221f04c89f9 (patch)
tree79cf46cd6fa4e8f2ba97879fdc0ae603a53136a1 /src/xsmfns.c
parent01537133a02670775337ddf930e933fde4818e8e (diff)
downloademacs-c187839de5677f0a6d7695647829a221f04c89f9.tar.gz
(smc_save_yourself_CB): Use get_current_dir_name.
Diffstat (limited to 'src/xsmfns.c')
-rw-r--r--src/xsmfns.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 4285dd76718..4b99d7be61a 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -52,10 +52,7 @@ Boston, MA 02110-1301, USA. */
#include "termopts.h"
#include "xterm.h"
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif /* not MAXPATHLEN */
-
+extern char * get_current_dir_name ();
/* The user login name. */
@@ -205,7 +202,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 +256,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 +275,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