From: newsham@aloha.net (Tim Newsham)
Subject: open and truncate
28 Jan 1997 20:33:50 -0800
Approved: cygnus.gnu-win32@cygnus.com
Distribution: cygnus
Message-ID: <199701290157.PAA14023.cygnus.gnu-win32@haleakala.aloha.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Original-To: gnu-win32@cygnus.com
X-Mailer: ELM [version 2.4 PL24 PGP3 *ALPHA*]
Original-Sender: owner-gnu-win32@cygnus.com


Hi,

    Open() will truncate existing files when the O_CREAT flag
is passed.  I mentioned this before and was told that this bug
is known.  I'm curious as to if its been fixed and will be
present in the next release or not.  Anyone know?

Details:
If you open an existing file with the O_CREAT flag set,
the file is opened and truncated to zero bytes:

    echo foo bar > test
    ...
        int fd = open("test", O_WRONLY | O_CREAT, 0666);
        close(fd);
    ...
    now "test" is an empty file

                                        Tim N.

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
