delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/12/06/18:50:31

From: newsham AT aloha DOT net (Tim Newsham)
Subject: Bug - O_CREAT
6 Dec 1996 18:50:31 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199612070121.PAA00796.cygnus.gnu-win32@haleakala.aloha.net>
Mime-Version: 1.0
Original-To: gnu-win32 AT cygnus DOT com
X-Mailer: ELM [version 2.4 PL24 PGP3 *ALPHA*]
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Hi,

    Stumbled across a problem in cygwin32.  The
open function does not behave as unix' open.  In
particular if an O_CREAT flag is passed and the file
already exists, the file is truncated to zero length.
The file should not be truncated as the O_TRUNC flag
was not specified.  As a test:

    #include <fcntl.h>

    main() {
        int fd = open("/tmp/foobar", O_RDWR | O_CREAT, 0666);
        close(fd);
    }

    echo foo > /tmp/foobar
    gcc test.c
    a.out
    ls -ld /tmp/foobar

I am not on this list so please CC me any correspondance
on the bug.

                                       Tim N.

-
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 -


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