Attachment "tclUnixPipe.diff" to
ticket [878333ffff]
added by
sussner
2004-01-16 22:25:55.
diff -Nru tcl/unix/tclUnixPipe.c tcl_mod/unix/tclUnixPipe.c
--- tcl/unix/tclUnixPipe.c 2003-02-22 01:25:07.000000000 +0100
+++ tcl_mod/unix/tclUnixPipe.c 2004-01-16 15:55:50.000000000 +0100
@@ -243,9 +243,32 @@
Tcl_Obj*
TclpTempFileName()
{
+#ifndef __sgi
char fileName[L_tmpnam + 9];
Tcl_Obj *result = NULL;
int fd;
+#else
+ /* These changes concern mainly loading dynamic libraries from
+ * others than the native filesystem, e.g. vfs of a tclkit.
+ *
+ * IRIX does not generate different temporary filenames when using
+ * the copyToPtr-mechanism of Tcl_FSLoadFile(). Although the previous
+ * temporary file was deleted immediately and a TclCrossFilesystemCopy()
+ * took place, the content of the previous temporary file (same
+ * filename!!!) seems to be present. I.e. only the first dynamic library
+ * is loaded (e.g. Itcl_Init was found) but all following libraries
+ * fail (e.g. "couldn't find procedure Tk_Init"). Using a different
+ * temporary filename seems to solve this problem. For this a static
+ * counter is included in the temporary filename. It is 5 digits long,
+ * i.e. 10000 dynamic libraries could be loaded from a tclkit (should
+ * be sufficient for the next few years :-) )
+ */
+ char fileName[L_tmpnam + 9 + 5];
+ Tcl_Obj *result = NULL;
+ int fd;
+ static int ctr=0;
+ char ctrStr[15];
+#endif
/*
* We should also check against making more then TMP_MAX of these.
@@ -255,7 +278,14 @@
if (fileName[strlen(fileName) - 1] != '/') {
strcat(fileName, "/"); /* INTL: Native. */
}
+#ifndef __sgi
strcat(fileName, "tclXXXXXX");
+#else
+ /* add static ctr*/
+ snprintf(ctrStr,14,"tcl%05iXXXXXX",ctr++);
+ strcat(fileName, ctrStr);
+#endif
+
fd = mkstemp(fileName); /* INTL: Native. */
if (fd == -1) {
return NULL;