From c63117c38d47dadda513598f71b40c99858180b0 Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 28 May 2012 18:17:41 +0000 Subject: [PATCH] Oops, get_current_dir_name() isn't available outside Linux; it even says so in the documentation. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2508 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/unix/FSNodePOSIX.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/unix/FSNodePOSIX.cxx b/src/unix/FSNodePOSIX.cxx index a602a24e7..0d3945a5f 100644 --- a/src/unix/FSNodePOSIX.cxx +++ b/src/unix/FSNodePOSIX.cxx @@ -162,10 +162,13 @@ POSIXFilesystemNode::POSIXFilesystemNode(const string& p, bool verify) else if ((p.length() >= 2 && p[0] == '.' && p[1] == '/') || (p.length() >= 1 && p[0] != '/')) { - char* cwd = get_current_dir_name(); #ifdef MAXPATHLEN + char buf[MAXPATHLEN]; + const char* cwd = getcwd(buf, MAXPATHLEN); if (cwd != NULL && strlen(cwd) < MAXPATHLEN) #else // No MAXPATHLEN, as happens on Hurd + char buf[1024]; + const char* cwd = getcwd(buf, 1024); if (cwd != NULL) #endif { @@ -177,7 +180,6 @@ POSIXFilesystemNode::POSIXFilesystemNode(const string& p, bool verify) else _path = _path + '/' + p; } - free(cwd); } else _path = p;