|
Message-ID: <20475045.GjpEljjT90@t450>
Date: Thu, 08 Oct 2020 10:55:47 -0400
From: John Scott <jscott@...teo.net>
To: musl@...ts.openwall.com
Subject: fputs/fputc doesn't set errno on failure
Hi,
I'm not subscribed, please keep me CC'd.
In this corner case, errno is unset despite fputs giving an error. I'm on Debian testing using musl-gcc 1.2.1.
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <errno.h>
#include <stdio.h>
int main(void) {
FILE *f = fopen("/", "r");
if(f == NULL) {
perror("fopen()");
}
if(fputs("Hello world\n", f) == EOF) {
assert(errno);
perror("fputs()");
}
}
With glibc this prints EBADF for fputs.
The wiki page about writing tests [1], which I thought this would be a good candidate for, has the 404 link http://nsz.repo.hu/git/?p=libc-test
Please let me know if I can help debugging.
[1] https://wiki.musl-libc.org/writing-tests.html
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
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.