summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixFile.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tclUnixFile.c')
-rw-r--r--unix/tclUnixFile.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 0b8aaf9..c187e0e 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -40,13 +40,13 @@ TclpFindExecutable(
* (native). */
{
#ifdef __CYGWIN__
+ int length;
char buf[PATH_MAX * TCL_UTF_MAX + 1];
char name[PATH_MAX * TCL_UTF_MAX + 1];
#else
const char *name, *p;
Tcl_StatBuf statBuf;
Tcl_DString buffer, nameString, cwd, utfName;
- Tcl_Encoding encoding;
#endif
#ifdef __CYGWIN__
@@ -66,9 +66,8 @@ TclpFindExecutable(
/* Strip '.exe' part. */
length -= 4;
}
- tclNativeExecutableName = (char *) ckalloc(length + 1);
- memcpy(tclNativeExecutableName, name, length);
- buf[length] = '\0';
+ TclSetObjNameOfExecutable(
+ Tcl_NewStringObj(name, length), Tcl_GetEncoding(NULL, NULL));
#else
if (argv0 == NULL) {
return;