delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/08/24/09:25:38

X-Spam-Check-By: sourceware.org
Message-ID: <46CEDC45.7070704@byu.net>
Date: Fri, 24 Aug 2007 07:25:25 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: cygwin1.dll bug in open(O_EXCL)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----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 AT byu DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019