From: <and...@us...> - 2010-01-06 20:21:41
|
Revision: 10737 http://plplot.svn.sourceforge.net/plplot/?rev=10737&view=rev Author: andrewross Date: 2010-01-06 20:21:34 +0000 (Wed, 06 Jan 2010) Log Message: ----------- Fix up pl_create_tempfile to properly delete temporary files once they are closed on UNIX-like systems. The call to unlink had been commented out during testing and not restored. Also add it a proper test for unlink in case there is a platform out there with mkstemp, but not unlink. Modified Paths: -------------- trunk/cmake/modules/plplot.cmake trunk/config.h.cmake trunk/src/plstdio.c Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2010-01-05 07:30:39 UTC (rev 10736) +++ trunk/cmake/modules/plplot.cmake 2010-01-06 20:21:34 UTC (rev 10737) @@ -243,6 +243,7 @@ check_function_exists(popen HAVE_POPEN) check_function_exists(usleep PL_HAVE_USLEEP) check_function_exists(mkstemp PL_HAVE_MKSTEMP) +check_function_exists(mkstemp PL_HAVE_UNLINK) # Check for FP functions, including underscored version which # are sometimes all that is available on windows Modified: trunk/config.h.cmake =================================================================== --- trunk/config.h.cmake 2010-01-05 07:30:39 UTC (rev 10736) +++ trunk/config.h.cmake 2010-01-06 20:21:34 UTC (rev 10737) @@ -153,6 +153,9 @@ /* Define to 1 if you have the <termios.h> header file. */ #cmakedefine HAVE_TERMIOS_H 1 +/* Define to 1 if the function unlink is available */ +#cmakedefine PL_HAVE_UNLINK 1 + /* Define to 1 if you have the `vfork' function. */ #cmakedefine HAVE_VFORK 1 Modified: trunk/src/plstdio.c =================================================================== --- trunk/src/plstdio.c 2010-01-05 07:30:39 UTC (rev 10736) +++ trunk/src/plstdio.c 2010-01-06 20:21:34 UTC (rev 10737) @@ -221,8 +221,10 @@ } /* If we are not returning the file name then unlink the file so it is * automatically deleted. */ - //if ( fname == NULL ) - // unlink( template ); +#ifdef PL_HAVE_UNLINK + if ( fname == NULL ) + unlink( template ); +#endif #else #if !defined ( _S_IREAD ) #define _S_IREAD 256 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |