From a3a7a7a2de88599a9be83d8596462b144d0fe115 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 15 Mar 2011 13:27:36 -0600 Subject: [PATCH] use getcwd instead of getenv("PWD") to get working directory PWD is not always set, whereas getcwd is more reliable. --- src/classpath-openjdk.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/classpath-openjdk.cpp b/src/classpath-openjdk.cpp index 4d50227a83..131f7345ff 100644 --- a/src/classpath-openjdk.cpp +++ b/src/classpath-openjdk.cpp @@ -59,6 +59,7 @@ typedef int socklen_t; #else // not PLATFORM_WINDOWS # include +# include # include # include # include @@ -2586,7 +2587,10 @@ jvmInitProperties(Thread* t, uintptr_t* arguments) # endif local::setProperty(t, method, *properties, "java.io.tmpdir", "/tmp"); local::setProperty(t, method, *properties, "user.home", getenv("HOME")); - local::setProperty(t, method, *properties, "user.dir", getenv("PWD")); + + char buffer[PATH_MAX]; + local::setProperty(t, method, *properties, "user.dir", + getcwd(buffer, PATH_MAX)); #endif local::setProperty(t, method, *properties, "java.protocol.handler.pkgs",