Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 08 Oct 2020 10:55:47 -0400
From: John Scott <>
Subject: fputs/fputc doesn't set errno on failure


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) {
	if(fputs("Hello world\n", f) == EOF) {

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

Please let me know if I can help debugging.

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.