mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:03:02 +01:00
Check for the function mkstemp(). If it's not available, fall back to mktemp().
This commit is contained in:
parent
5de86cc700
commit
d496ef4e4e
@ -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 ###############################
|
dnl ############################# INITIALISATION ###############################
|
||||||
|
|
||||||
@ -380,6 +380,7 @@ if test "$ac_cv_func_getmntent" = "yes"; then
|
|||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
fi
|
fi
|
||||||
AC_CHECK_FUNCS(tcgetattr strdup)
|
AC_CHECK_FUNCS(tcgetattr strdup)
|
||||||
|
AC_CHECK_FUNCS(mkstemp)
|
||||||
|
|
||||||
|
|
||||||
dnl Check for other things
|
dnl Check for other things
|
||||||
|
@ -159,6 +159,7 @@
|
|||||||
#undef GETMNTENT_TAKES_TWO_ARGUMENTS
|
#undef GETMNTENT_TAKES_TWO_ARGUMENTS
|
||||||
#undef HAVE_TCGETATTR
|
#undef HAVE_TCGETATTR
|
||||||
#define HAVE_STRDUP
|
#define HAVE_STRDUP
|
||||||
|
#define HAVE_MKSTEMP
|
||||||
|
|
||||||
|
|
||||||
/* Types */
|
/* Types */
|
||||||
|
@ -2312,7 +2312,13 @@ void * API_ROUTINE gds__temp_file(
|
|||||||
strcat(file_name, string);
|
strcat(file_name, string);
|
||||||
strcat(file_name, TEMP_PATTERN);
|
strcat(file_name, TEMP_PATTERN);
|
||||||
|
|
||||||
|
#ifdef HAVE_MKSTEMP
|
||||||
void *result = (void *)mkstemp(file_name);
|
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)
|
if (result == (void *)-1)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -44,5 +44,3 @@ typedef struct stk {
|
|||||||
#define PARAM_POINTER(PARAM) (SCHAR) dtype_long, (UCHAR*) PARAM
|
#define PARAM_POINTER(PARAM) (SCHAR) dtype_long, (UCHAR*) PARAM
|
||||||
|
|
||||||
#endif /* _JRD_MISC_H_ */
|
#endif /* _JRD_MISC_H_ */
|
||||||
|
|
||||||
#define MKTEMP(fname, prefix) mktemp(fname)
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*
|
*
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
* Contributor(s): ______________________________________.
|
* 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
|
* 2001-09-24 SJL - Temporary fix for large sort file bug
|
||||||
*
|
*
|
||||||
@ -3033,7 +3033,7 @@ static void write_trace(
|
|||||||
#else
|
#else
|
||||||
strcpy(file_name, "/interbase/DEBUG_SORT_TRACE_XXXXXX");
|
strcpy(file_name, "/interbase/DEBUG_SORT_TRACE_XXXXXX");
|
||||||
#endif
|
#endif
|
||||||
#if defined FREEBSD || defined NETBSD
|
#ifdef HAVE_MKSTEMP
|
||||||
fd = mkstemp(file_name);
|
fd = mkstemp(file_name);
|
||||||
trace_file = fdopen(fd, "w");
|
trace_file = fdopen(fd, "w");
|
||||||
#else
|
#else
|
||||||
|
@ -2186,14 +2186,15 @@ static int edit(
|
|||||||
*/
|
*/
|
||||||
sprintf(file_name, "%sXXXXXX", buffer);
|
sprintf(file_name, "%sXXXXXX", buffer);
|
||||||
|
|
||||||
#if defined FREEBSD || defined NETBSD
|
#ifdef HAVE_MKSTEMP
|
||||||
fd = mkstemp(file_name);
|
fd = mkstemp(file_name);
|
||||||
if (!(file = fdopen(fd, "w+"))) {
|
if (!(file = fdopen(fd, "w+"))) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
MKTEMP(file_name, "XXXXXXX");
|
if (mktemp(file_name) == (char *)0)
|
||||||
|
return FALSE;
|
||||||
if (!(file = ib_fopen(file_name, FOPEN_WRITE_TYPE)))
|
if (!(file = ib_fopen(file_name, FOPEN_WRITE_TYPE)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ib_fclose(file);
|
ib_fclose(file);
|
||||||
|
@ -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:
|
* 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports:
|
||||||
@ -107,6 +107,7 @@
|
|||||||
#undef GETMNTENT_TAKES_TWO_ARGUMENTS
|
#undef GETMNTENT_TAKES_TWO_ARGUMENTS
|
||||||
#undef HAVE_TCGETATTR
|
#undef HAVE_TCGETATTR
|
||||||
#undef HAVE_STRDUP
|
#undef HAVE_STRDUP
|
||||||
|
#undef HAVE_MKSTEMP
|
||||||
|
|
||||||
|
|
||||||
/* Types */
|
/* Types */
|
||||||
|
Loading…
Reference in New Issue
Block a user