tests : Always pass 0 as the third argument to open when OS_IS_WIN32.

This commit is contained in:
Erik de Castro Lopo 2008-04-06 20:26:16 +10:00
parent 6e98e65ca3
commit ef033ccb8c
3 changed files with 13 additions and 6 deletions

View File

@ -3,6 +3,9 @@
* tests/*.c
Add calls to sf_close() where needed.
* tests/utils.tpl tests/multi_file_test.c
Always pass 0 as the third argument to open when OS_IS_WIN32.
2008-04-03 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/test_*

View File

@ -131,13 +131,15 @@ multi_file_test (const char *filename, int *formats, int format_count)
SF_INFO sfinfo ;
SF_EMBED_FILE_INFO embed_info ;
sf_count_t filelen ;
int fd, k, file_count = 0 ;
int fd, k, file_count = 0, open_perm ;
print_test_name ("multi_file_test", filename) ;
unlink (filename) ;
if ((fd = open (filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP )) < 0)
open_perm = OS_IS_WIN32 ? 0 : S_IRUSR | S_IWUSR | S_IRGRP ;
if ((fd = open (filename, O_RDWR | O_CREAT, open_perm)) < 0)
{ printf ("\n\nLine %d: open failed : %s\n", __LINE__, strerror (errno)) ;
exit (1) ;
} ;

View File

@ -476,13 +476,15 @@ test_open_file_or_die (const char *filename, int mode, SF_INFO *sfinfo, int allo
exit (1) ;
} ;
if (OS_IS_WIN32)
{ /* Windows doesn't support Unix file permissions so set it to zero. */
omode = 0 ;
} ;
if (allow_fd && ((++count) & 1) == 1)
{ int fd ;
if (omode == 0)
fd = open (filename, oflags) ;
else
fd = open (filename, oflags, omode) ;
fd = open (filename, oflags, omode) ;
if (fd < 0)
{ perror ("open") ;