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]

Re: cygwin1.dll bug in open(O_EXCL)

On Aug 24 07:25, Eric Blake wrote:
> Hash: SHA1
> I finally found root cause for the tar issue reported here:
> $ 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.

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.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Unsubscribe info:
Problem reports:

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