diff --git a/configure.in b/configure.in index a39e29ac9b..0e5980fdde 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.133 2003-04-17 18:42:12 bellardo Exp $ +dnl $Id: configure.in,v 1.134 2003-05-14 05:39:55 eku Exp $ dnl ############################# INITIALISATION ############################### @@ -380,6 +380,7 @@ if test "$ac_cv_func_getmntent" = "yes"; then [AC_MSG_RESULT(no)]) fi AC_CHECK_FUNCS(tcgetattr strdup) +AC_CHECK_FUNCS(mkstemp) dnl Check for other things diff --git a/src/include/gen/autoconfig_msvc.h b/src/include/gen/autoconfig_msvc.h index 1c2ffd2994..59d3777205 100644 --- a/src/include/gen/autoconfig_msvc.h +++ b/src/include/gen/autoconfig_msvc.h @@ -159,6 +159,7 @@ #undef GETMNTENT_TAKES_TWO_ARGUMENTS #undef HAVE_TCGETATTR #define HAVE_STRDUP +#define HAVE_MKSTEMP /* Types */ diff --git a/src/jrd/gds.cpp b/src/jrd/gds.cpp index 43776ac9a7..f11399452c 100644 --- a/src/jrd/gds.cpp +++ b/src/jrd/gds.cpp @@ -2312,7 +2312,13 @@ void * API_ROUTINE gds__temp_file( strcat(file_name, string); strcat(file_name, TEMP_PATTERN); +#ifdef HAVE_MKSTEMP void *result = (void *)mkstemp(file_name); +#else + if (mktemp(file_name) == (char *)0) + return (void *)-1; + void *result = (void *)open(file_name, O_RDWR | O_CREAT); +#endif if (result == (void *)-1) return result; diff --git a/src/jrd/misc.h b/src/jrd/misc.h index 13b3469a4a..ecaa7ae30b 100644 --- a/src/jrd/misc.h +++ b/src/jrd/misc.h @@ -44,5 +44,3 @@ typedef struct stk { #define PARAM_POINTER(PARAM) (SCHAR) dtype_long, (UCHAR*) PARAM #endif /* _JRD_MISC_H_ */ - -#define MKTEMP(fname, prefix) mktemp(fname) diff --git a/src/jrd/sort.cpp b/src/jrd/sort.cpp index 6d08183516..cfaff59910 100644 --- a/src/jrd/sort.cpp +++ b/src/jrd/sort.cpp @@ -19,7 +19,7 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. - * $Id: sort.cpp,v 1.35 2003-05-09 16:18:32 skidder Exp $ + * $Id: sort.cpp,v 1.36 2003-05-14 05:39:59 eku Exp $ * * 2001-09-24 SJL - Temporary fix for large sort file bug * @@ -3033,7 +3033,7 @@ static void write_trace( #else strcpy(file_name, "/interbase/DEBUG_SORT_TRACE_XXXXXX"); #endif -#if defined FREEBSD || defined NETBSD +#ifdef HAVE_MKSTEMP fd = mkstemp(file_name); trace_file = fdopen(fd, "w"); #else diff --git a/src/jrd/utl.cpp b/src/jrd/utl.cpp index 749607a4ad..7671367a4e 100644 --- a/src/jrd/utl.cpp +++ b/src/jrd/utl.cpp @@ -2186,14 +2186,15 @@ static int edit( */ sprintf(file_name, "%sXXXXXX", buffer); -#if defined FREEBSD || defined NETBSD +#ifdef HAVE_MKSTEMP fd = mkstemp(file_name); if (!(file = fdopen(fd, "w+"))) { close(fd); return FALSE; } #else - MKTEMP(file_name, "XXXXXXX"); + if (mktemp(file_name) == (char *)0) + return FALSE; if (!(file = ib_fopen(file_name, FOPEN_WRITE_TYPE))) return FALSE; ib_fclose(file); diff --git a/src/make.new/config/config.h.in b/src/make.new/config/config.h.in index 3b89976f5b..e581a70d48 100644 --- a/src/make.new/config/config.h.in +++ b/src/make.new/config/config.h.in @@ -1,4 +1,4 @@ -#ident "$Id: config.h.in,v 1.74 2003-03-13 15:45:32 alexpeshkoff Exp $" +#ident "$Id: config.h.in,v 1.75 2003-05-14 05:40:00 eku Exp $" /* * 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports: @@ -107,6 +107,7 @@ #undef GETMNTENT_TAKES_TWO_ARGUMENTS #undef HAVE_TCGETATTR #undef HAVE_STRDUP +#undef HAVE_MKSTEMP /* Types */