(trunk libT) #4625 "Transmission 2.42 fails to build on Solaris 10: Undefined symbol 'mkdtemp'" -- fixed.

This commit is contained in:
Jordan Lee
2011-11-10 03:31:43 +00:00
parent 4caa05b143
commit b3d382874a
4 changed files with 18 additions and 2 deletions

View File

@@ -101,7 +101,7 @@ AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS([stdbool.h])
AC_CHECK_FUNCS([iconv_open pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll])
AC_CHECK_FUNCS([iconv_open pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll mkdtemp])
AC_PROG_INSTALL
AC_PROG_MAKE_SET
ACX_PTHREAD

View File

@@ -2756,7 +2756,7 @@ deleteLocalData( tr_torrent * tor, tr_fileFunc func )
base = tr_strdup_printf( "%s__XXXXXX", tr_torrentName( tor ) );
tmpdir = tr_buildPath( top, base, NULL );
mkdtemp( tmpdir );
tr_mkdtemp( tmpdir );
tr_free( base );
for( f=0; f<tor->info.fileCount; ++f )

View File

@@ -17,6 +17,7 @@
#if defined(SYS_DARWIN)
#define HAVE_GETPAGESIZE
#define HAVE_ICONV_OPEN
#define HAVE_MKDTEMP
#define HAVE_VALLOC
#endif
@@ -504,6 +505,18 @@ tr_dirname( const char * path )
return ret;
}
char*
tr_mkdtemp( char * template )
{
#ifdef HAVE_MKDTEMP
return mkdtemp( template );
#else
if( !mktemp( template ) || mkdir( template, 0700 ) )
return NULL;
return template;
#endif
}
int
tr_mkdir( const char * path,
int permissions

View File

@@ -222,6 +222,9 @@ int tr_mkdir( const char * path, int permissions ) TR_GNUC_NONNULL(1);
*/
int tr_mkdirp( const char * path, int permissions ) TR_GNUC_NONNULL(1);
/** @brief Portability wrapper for mkdtemp() that uses the system implementation if available */
char* tr_mkdtemp( char * template );
/**
* @brief Loads a file and returns its contents.