mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] fputs/fputc doesn't set errno on failure
@ 2020-10-08 14:55 John Scott
  2020-10-08 16:21 ` Rich Felker
  2020-10-08 16:23 ` Markus Wichmann
  0 siblings, 2 replies; 4+ messages in thread
From: John Scott @ 2020-10-08 14:55 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-08 19:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08 14:55 [musl] fputs/fputc doesn't set errno on failure John Scott
2020-10-08 16:21 ` Rich Felker
2020-10-08 16:23 ` Markus Wichmann
2020-10-08 19:55   ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).