Changeset 424
- Timestamp:
- 06/19/10 20:40:21 (3 months ago)
- Files:
-
- trunk/functions/stdio/fclose.c (modified) (1 diff)
- trunk/platform/example/functions/stdio/tmpfile.c (modified) (4 diffs)
- trunk/platform/example/internals/_PDCLIB_config.h (modified) (1 diff)
- trunk/platform/example_64/internals/_PDCLIB_config.h (modified) (1 diff)
- trunk/platform/example_cygwin/internals/_PDCLIB_config.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/functions/stdio/fclose.c
r420 r424 44 44 _PDCLIB_filelist = stream->next; 45 45 } 46 /* Delete tmpfile() */ 47 if ( stream->status & _PDCLIB_DELONCLOSE ) 48 { 49 remove( stream->filename ); 50 } 46 51 /* Free stream */ 47 52 free( stream ); 53 48 54 return 0; 49 55 } trunk/platform/example/functions/stdio/tmpfile.c
r420 r424 25 25 26 26 /* This is an example implementation of tmpfile() fit for use with POSIX 27 POSIXkernels.27 kernels. 28 28 */ 29 29 struct _PDCLIB_file_t * tmpfile( void ) … … 33 33 appropriate. 34 34 */ 35 FILE * randomsource = fopen( "/ dev/urandom", "rb" );35 FILE * randomsource = fopen( "/proc/sys/kernel/random/uuid", "rb" ); 36 36 char filename[ L_tmpnam ]; 37 37 _PDCLIB_fd_t fd; … … 49 49 generate the filename candidate, which is *also* platform-dependent. 50 50 */ 51 u int32_t random;52 fscanf( randomsource, "% " SCNu32, &random );53 sprintf( filename, "/tmp/% 010" PRNu32 ".tmp", random );51 unsigned int random; 52 fscanf( randomsource, "%u", &random ); 53 sprintf( filename, "/tmp/%u.tmp", random ); 54 54 /* Check if file of this name exists. Note that fopen() is a very weak 55 55 check, which does not take e.g. access permissions into account … … 72 72 return NULL; 73 73 } 74 rc->status = _PDCLIB_filemode( "wb+" ) | _ PDCLIB_LIBBUFFER | _IOLBF | _PDCLIB_DELONCLOSE;74 rc->status = _PDCLIB_filemode( "wb+" ) | _IOLBF | _PDCLIB_DELONCLOSE; 75 75 rc->handle = fd; 76 76 rc->ungetbuf = (unsigned char *)rc + sizeof( struct _PDCLIB_file_t ); trunk/platform/example/internals/_PDCLIB_config.h
r414 r424 259 259 #define _PDCLIB_FILENAME_MAX 128 260 260 261 /* Buffer size for tmpnam().*/262 #define _PDCLIB_L_tmpnam 100261 /* Maximum length of filenames generated by tmpnam(). (See tmpfile.c.) */ 262 #define _PDCLIB_L_tmpnam 46 263 263 264 264 /* Number of distinct file names that can be generated by tmpnam(). */ trunk/platform/example_64/internals/_PDCLIB_config.h
r415 r424 252 252 #define _PDCLIB_FILENAME_MAX 128 253 253 254 /* Buffer size for tmpnam().*/255 #define _PDCLIB_L_tmpnam 100254 /* Maximum length of filenames generated by tmpnam(). (See tmpfile.c.) */ 255 #define _PDCLIB_L_tmpnam 46 256 256 257 257 /* Number of distinct file names that can be generated by tmpnam(). */ trunk/platform/example_cygwin/internals/_PDCLIB_config.h
r415 r424 259 259 #define _PDCLIB_FILENAME_MAX 128 260 260 261 /* Buffer size for tmpnam(). */262 #define _PDCLIB_L_tmpnam 100263 264 261 /* Number of distinct file names that can be generated by tmpnam(). */ 265 262 #define _PDCLIB_TMP_MAX 50
