This is the mail archive of the
mailing list for the Cygwin project.
Re: cygwin1.dll bug in open(O_EXCL)
-----BEGIN PGP SIGNED MESSAGE-----
According to Corinna Vinschen on 8/24/2007 8:56 AM:
>> According to POSIX, this should have failed with EEXIST, and oops should
>> not have been created.
> If I understand this right, it means that O_EXCL implies not following
> symlinks. I've applied a matching patch to CVS. Please give it a try.
Looks like that got it. Once cygwin 1.7.0 comes out, I will revert my
hack to tar-1.18-2 (I had to add a non-atomic lstat prior to the
open(O_CREAT|O_EXCL) to check for the existence of symlinks; it fixes the
original bug in tar behavior, but adds an alternate bug in the form of a
small race window where a malicious symlink could be injected between the
lstat and open).
As a side effect of your change, open("broken_symlink", O_RDWR|O_EXCL) now
fails with EACCES instead of ENOENT, but since POSIX leaves O_EXCL without
O_CREAT as undefined behavior, I'm not too worried (I checked this case,
because your patch made it so that the code path actually defers to
fhandler::open on a symlink, whereas before it did not; I don't care what
the error is, as long as it is not possible to grab an fd on a raw
Don't work too hard, make some time for fun as well!
Eric Blake firstname.lastname@example.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html