Fix initial position for files opened with O_APPEND flag.
This commit is contained in:
parent
9e18b7efa9
commit
a6a5fb7a70
|
@ -1480,13 +1480,6 @@ int MSVCRT__sopen( const char *path, int oflags, int shflags, ... )
|
|||
fd = msvcrt_alloc_fd(hand, wxflag);
|
||||
|
||||
TRACE(":fd (%d) handle (%p)\n",fd, hand);
|
||||
|
||||
if (fd > 0)
|
||||
{
|
||||
if (oflags & MSVCRT__O_APPEND)
|
||||
_lseek(fd, 0, FILE_END);
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,6 +242,14 @@ static void test_file_write_read( void )
|
|||
ok( memcmp(mytext,btext,strlen(mytext)) == 0,
|
||||
"problems with _O_TEXT _write / _read\n");
|
||||
_close(tempfd);
|
||||
|
||||
memset(btext, 0, LLEN);
|
||||
tempfd = _open(tempf,_O_APPEND|_O_RDWR); /* open for APPEND in default mode */
|
||||
ok(tell(tempfd) == 0, "bad position %lu expecting 0\n", tell(tempfd));
|
||||
ok(_read(tempfd,btext,LLEN) == lstrlenA(mytext), "_read _O_APPEND got bad length\n");
|
||||
ok( memcmp(mytext,btext,strlen(mytext)) == 0, "problems with _O_APPEND _read\n");
|
||||
_close(tempfd);
|
||||
|
||||
ret = unlink(tempf);
|
||||
ok( ret !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
|
||||
|
||||
|
|
Loading…
Reference in New Issue