NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

standards/59847: fflush(3) fails with EBADFD on read only file pointers



>Number:         59847
>Category:       standards
>Synopsis:       fflush(3) fails with EBADFD on read only file pointers
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 18 16:55:00 +0000 2025
>Originator:     Christos Zoulas
>Release:        NetBSD 11.99.3
>Organization:
	Flushing Meadows, Inc.
>Environment:
System: NetBSD quasar.astron.com 11.99.3 NetBSD 11.99.3 (QUASAR) #62: Fri Oct 10 11:37:31 EDT 2025 christos%quasar.astron.com@localhost:/usr/src/sys/arch/amd64/compile/QUASAR amd64
Architecture: x86_64
Machine: amd64
>Description:
	fflush fails on read only fp.	
>How-To-Repeat:

#include <stdio.h>
#include <err.h>

int
main(void)
{
	char p;
	FILE *fp = fopen("/dev/null", "r");
	if (fp == NULL)
		err(1, "fopen");
	if (fread(&p, 1, 1, fp) != 0)
		err(1, "fread");
	if (fflush(fp) < 0)
		err(1, "fflush");
	if (fclose(fp) < 0)
		err(1, "fclose");
	return 0;
}

>Fix:
	fixed in fflush.c 1.25



Home | Main Index | Thread Index | Old Index