summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--unix/tclUnixFile.c7
-rwxr-xr-xwin/tclWinFile.c2
2 files changed, 6 insertions, 3 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 2cb0027..7ffbf8d 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -155,6 +155,11 @@ TclpFindExecutable(
goto done;
}
+ if (TclpGetCwd(NULL, &cwd) == NULL) {
+ TclSetObjNameOfExecutable(Tcl_NewObj(), NULL);
+ goto done;
+ }
+
/*
* The name is relative to the current working directory. First strip off
* a leading "./", if any, then add the full path name of the current
@@ -168,8 +173,6 @@ TclpFindExecutable(
Tcl_DStringInit(&nameString);
Tcl_DStringAppend(&nameString, name, -1);
- TclpGetCwd(NULL, &cwd);
-
Tcl_DStringFree(&buffer);
Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&cwd),
Tcl_DStringLength(&cwd), &buffer);
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 6b9d373..02927ad 100755
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -3001,7 +3001,7 @@ TclNativeCreateNativeRep(
}
done:
-
+
TclDecrRefCount(validPathPtr);
return nativePathPtr;
}