This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cygwin1.dll bug in open(O_EXCL)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I finally found root cause for the tar issue reported here:
http://cygwin.com/ml/cygwin/2007-08/msg00553.html

$ cat foo.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>

int main(int argc, char**argv)
{
  int fd;
  symlink ("oops", "broken");
  fd = open ("broken", O_WRONLY|O_CREAT|O_EXCL, 0600);
  printf ("fd=%d, errno=%d: %s\n", fd, errno, strerror (errno));
  return 0;
}
$ ./foo
fd=3, errno=0: No error
$ ls -F oops broken
broken@  oops

According to POSIX, this should have failed with EEXIST, and oops should
not have been created.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----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

iD8DBQFGztxF84KuGfSFAYARAuy7AJ0dEKFjtXGpkeMDVAwfb04JuKJApQCfZHMs
k3jIVFTIcvmMoh6y1FsoNsc=
=1A5D
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]