Mail Archives: cygwin/1997/01/02/11:24:56
I started looking for this bug with tar's failure to overwrite files. It
turns out the open() didn't work well for some unusual flag combinations.
The following patch fixes tar (which uses both O_TRUNC and O_APPEND)
and appears to conform to my man pages for open().
Scott
*** cdksrc/src/winsup/fhandler.cc.orig Mon Dec 30 17:04:41 1996
--- cdksrc/src/winsup/fhandler.cc Mon Dec 30 17:18:01 1996
***************
*** 318,333 ****
access_ = GENERIC_READ | GENERIC_WRITE;
}
! /* FIXME: O_EXCL handling? */
!
! if (flags & O_CREAT)
! creation_distribution = CREATE_ALWAYS;
else
! creation_distribution = OPEN_EXISTING;
if (flags & O_APPEND)
{
- creation_distribution = OPEN_ALWAYS;
append_p_ = 1;
}
--- 318,353 ----
access_ = GENERIC_READ | GENERIC_WRITE;
}
! if ((flags & O_TRUNC) && ((flags & O_ACCMODE) != O_RDONLY))
! {
! if (flags & O_CREAT)
! {
! creation_distribution = CREATE_ALWAYS;
! }
! else
! {
! creation_distribution = TRUNCATE_EXISTING;
! }
! }
else
! {
! if (flags & O_CREAT)
! {
! creation_distribution = OPEN_ALWAYS;
! }
! else
! {
! creation_distribution = OPEN_EXISTING;
! }
! }
!
! if ((flags & O_EXCL) && (flags & O_CREAT))
! {
! creation_distribution = CREATE_NEW;
! }
if (flags & O_APPEND)
{
append_p_ = 1;
}
----------------------------------
Scott Kempf (scottk AT ig DOT utexas DOT edu)
Running gnu-win32 beta 17.1
under Windows 95.
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -