Windows: don't set create time for invalid/stream fd (#2571)
This commit is contained in:
parent
e0bb8e5d58
commit
b28ee777ab
@ -586,6 +586,12 @@ vips__set_create_time( int fd )
|
||||
SYSTEMTIME st;
|
||||
FILETIME ft;
|
||||
|
||||
/* Create time cannot be set on invalid or stream
|
||||
* (stdin, stdout, stderr) file descriptors.
|
||||
*/
|
||||
if( fd < 3 )
|
||||
return;
|
||||
|
||||
if( (handle = (HANDLE) _get_osfhandle( fd )) == INVALID_HANDLE_VALUE )
|
||||
return;
|
||||
GetSystemTime( &st );
|
||||
@ -635,7 +641,7 @@ vips__fopen( const char *filename, const char *mode )
|
||||
fp = g_fopen( filename, mode );
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
if( mode[0] == 'w' )
|
||||
if( fp && mode[0] == 'w' )
|
||||
vips__set_create_time( _fileno( fp ) );
|
||||
#endif /*G_OS_WIN32*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user