|
|
Message-ID: <20211013072512.GB15338@altlinux.org>
Date: Wed, 13 Oct 2021 10:25:12 +0300
From: "Dmitry V. Levin" <ldv@...linux.org>
To: musl@...ts.openwall.com
Subject: Re: errno on writing to read-only files
Hi,
On Wed, Oct 13, 2021 at 01:21:31AM +0000, (GalaxyMaster) wrote:
> Hello,
>
> I am observing the following on musl and I am not sure that this is the way it
> should be:
> ===
> galaxy@...hlinux:~/musl-tests $ cat fput-to-readonly.c
> #include <stdio.h>
> #include <errno.h>
>
> int main() {
> FILE *f;
> int i = 0;
> f = fopen("fput-to-readonly.c", "r");
> errno = 0;
> i = fputs("should not be written", f);
> printf("i = %d (should be negative [EOF = %d])\n", i, EOF);
> printf("errno = %d\n", errno);
Note that the first "printf" invocation is allowed to clobber errno
and this is not musl-specific.
--
ldv
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.