Subject: open and truncate
From: [email-masked] (Tim Newsham)

28 Jan 1997 20:33:50 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Original-To: [email-masked]
X-Mailer: ELM [version 2.4 PL24 PGP3 *ALPHA*]
Original-Sender: [email-masked]

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
"[email-masked]" with one line of text: "help".