2001-05-14 12:42:49 -04:00
|
|
|
|
$OpenBSD: patch-tcl_tclCmdAH_c,v 1.1 2001/05/14 16:42:55 millert Exp $
|
|
|
|
|
--- tcl/tclCmdAH.c.orig Fri Feb 24 14:19:53 1995
|
|
|
|
|
+++ tcl/tclCmdAH.c Mon May 14 10:33:02 2001
|
|
|
|
|
@@ -38,9 +38,17 @@ static char rcsid[] = "$Header: /home/ag
|
2000-01-16 04:26:46 -05:00
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
#include "tclInt.h"
|
|
|
|
|
|
|
|
|
|
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
|
|
|
|
+#include <sys/param.h>
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
extern int errno;
|
|
|
|
|
+#if !(defined(BSD) && BSD >= 199306)
|
|
|
|
|
extern long lseek();
|
2000-01-16 06:10:49 -05:00
|
|
|
|
+#endif
|
|
|
|
|
+#ifndef BSD4_4
|
|
|
|
|
extern char *mktemp();
|
2000-01-16 04:26:46 -05:00
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*----------------------------------------------------------------------
|
2001-05-14 12:42:49 -04:00
|
|
|
|
@@ -430,7 +438,7 @@ Tcl_ExecCmd(dummy, interp, argc, argv)
|
2000-01-16 06:10:49 -05:00
|
|
|
|
int pid = -1; /* -1 means child process doesn't
|
|
|
|
|
* exist (yet). Non-zero gives its
|
|
|
|
|
* id (0 only in child). */
|
|
|
|
|
- union wait status;
|
|
|
|
|
+ int status;
|
|
|
|
|
char *cmdName, *execName;
|
|
|
|
|
|
|
|
|
|
/*
|
2001-05-14 12:42:49 -04:00
|
|
|
|
@@ -501,8 +509,13 @@ Tcl_ExecCmd(dummy, interp, argc, argv)
|
2000-01-16 04:26:46 -05:00
|
|
|
|
} else {
|
|
|
|
|
char tmp[sizeof(TMP_FILE_NAME) + 1];
|
|
|
|
|
strcpy(tmp, TMP_FILE_NAME);
|
2000-01-16 06:10:49 -05:00
|
|
|
|
+#ifdef BSD4_4
|
|
|
|
|
+ mkstemp(tmp);
|
2000-01-16 04:26:46 -05:00
|
|
|
|
+ stdIn[0] = mkstemp(tmp);
|
2000-01-16 06:10:49 -05:00
|
|
|
|
+#else
|
|
|
|
|
mktemp(tmp);
|
|
|
|
|
stdIn[0] = open(tmp, O_RDWR|O_CREAT, 0);
|
|
|
|
|
+#endif
|
2000-01-16 04:26:46 -05:00
|
|
|
|
if (stdIn[0] < 0) {
|
|
|
|
|
sprintf(interp->result,
|
|
|
|
|
"couldn't create input file for \"%.50s\" command: %.50s",
|
2001-05-14 12:42:49 -04:00
|
|
|
|
@@ -642,7 +655,7 @@ Tcl_ExecCmd(dummy, interp, argc, argv)
|
2000-01-16 06:10:49 -05:00
|
|
|
|
sprintf(interp->result, "command terminated abnormally");
|
|
|
|
|
result = TCL_ERROR;
|
|
|
|
|
}
|
|
|
|
|
- result = status.w_retcode;
|
|
|
|
|
+ result = WEXITSTATUS(status);
|
|
|
|
|
}
|
|
|
|
|
if (stdIn[0] != -1) {
|
|
|
|
|
close(stdIn[0]);
|