Opened 3 months ago

Closed 3 months ago

#19060 closed bug (fixed)

fdopendir() does not fail with EBADF when it should

Reported by: bhaible Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/POSIX Version: R1/beta5
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

POSIX https://pubs.opengroup.org/onlinepubs/9799919799/functions/fdopendir.html specifies that the fdopendir() function "shall fail" with error code EBADF if "The fd argument is not a valid file descriptor open for reading."

This does not work in Haiku hrev57823 (from 2024-07-15): it fails with error code EINVAL instead.

How to reproduce: Compile and run the attached test program.

gcc -Wall foo.c
./a.out

Expected output:

ret = NULL, errno == EBADF
OK

Actual output:

ret = NULL, errno == Invalid Argument
a.out: foo.c:21:main: ret < 0 && errno == EBADF
Kill Thread

Attachments (1)

foo.c (437 bytes ) - added by bhaible 3 months ago.
test case foo.c

Download all attachments as: .zip

Change History (2)

by bhaible, 3 months ago

Attachment: foo.c added

test case foo.c

comment:1 by waddlesplash, 3 months ago

Resolution: fixed
Status: newclosed

This one, at least, is fixed in hrev58058.

Note: See TracTickets for help on using tickets.