Opened 4 months ago

Closed 3 weeks ago

Last modified 3 weeks ago

#19062 closed bug (fixed)

open() does not fail with ENOENT when it should

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

Description

POSIX https://pubs.opengroup.org/onlinepubs/9799919799/functions/open.html specifies that the open() function "shall fail" with error code ENOENT if "O_CREAT is set and a component of the path prefix of path does not name an existing file".

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

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

gcc -Wall foo.c
./a.out

Expected output:

ret = -1, errno == ENOENT
OK

Actual output:

ret = -1, errno == Invalid Argument
a.out: foo.c:31:main: errno == ENOENT
Kill Thread

Attachments (1)

foo.c (736 bytes ) - added by bhaible 4 months ago.
test case foo.c

Download all attachments as: .zip

Change History (4)

by bhaible, 4 months ago

Attachment: foo.c added

test case foo.c

comment:2 by waddlesplash, 3 weeks ago

Milestone: UnscheduledR1/beta6
Resolution: fixed
Status: newclosed

Fix merged in hrev58376.

comment:3 by waddlesplash, 3 weeks ago

Committed the tests for this and #18355 in hrev58379.

Note: See TracTickets for help on using tickets.