mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
Make sure we don't truncate the file on open before we have checked
the sharing modes (thanks to Dmitry Timoshkov for the test case).
This commit is contained in:
parent
8811628cff
commit
60287d0ac2
1 changed files with 2 additions and 1 deletions
|
@ -944,7 +944,7 @@ struct fd *open_fd( struct fd *fd, const char *name, int flags, mode_t *mode,
|
||||||
}
|
}
|
||||||
flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
|
flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
|
||||||
}
|
}
|
||||||
if ((fd->unix_fd = open( name, flags, *mode )) == -1)
|
if ((fd->unix_fd = open( name, flags & ~O_TRUNC, *mode )) == -1)
|
||||||
{
|
{
|
||||||
file_set_error();
|
file_set_error();
|
||||||
release_object( fd );
|
release_object( fd );
|
||||||
|
@ -990,6 +990,7 @@ struct fd *open_fd( struct fd *fd, const char *name, int flags, mode_t *mode,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy( closed_fd->unlink, unlink_name );
|
strcpy( closed_fd->unlink, unlink_name );
|
||||||
|
if (flags & O_TRUNC) ftruncate( fd->unix_fd, 0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue