lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMo8BfLp2e_sO=3-++TkjxiUm_syTuxndj5H37YLddYqk-54tg@mail.gmail.com>
Date:	Tue, 16 Oct 2012 03:42:52 +0400
From:	Max Filippov <jcmvbkbc@...il.com>
To:	Philippe Troin <phil@...i.org>
Cc:	Dave Chinner <david@...morbit.com>,
	Juliusz Chroboczek <jch@....jussieu.fr>,
	linux-kernel@...r.kernel.org
Subject: Re: Write is not atomic?

On Tue, Oct 16, 2012 at 3:24 AM, Philippe Troin <phil@...i.org> wrote:
> On Tue, 2012-10-16 at 10:13 +1100, Dave Chinner wrote:
>> On Mon, Oct 15, 2012 at 11:36:15PM +0200, Juliusz Chroboczek wrote:
>> > The following fragment of code
>> >
>> >     int fd;
>> >     fd = open("exemple", O_CREAT | O_WRONLY | O_TRUNC, 0666);
>> >     fork();
>> >     write(fd, "Ouille", 6);
>> >     close(fd);
>
> can be replaced with:
>
>         int fd;
>         fd = open("exemple", O_CREAT | O_WRONLY | O_TRUNC | O_APPEND, 0666);
>         fork();
>         write(fd, "Ouille", 6);
>         close(fd);

Fails the same way as the original. I guess O_APPEND doesn't work this way
for writes to the shared file descriptor.

-- 
Thanks.
-- Max
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ