-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
Problem:
I'm trying to use O_DIRECTORY
with open(2).
It says, if pathname is not a directory, cause the open to fail.
jnr-posix does not seem to fail when opening a file with O_DIRECTORY.
Example:
mkdir dir_example;
touch file_example;
POSIX posix = POSIXFactory.getNativePOSIX();
int fd1 = posix.open("dir_example", OpenFlags.O_DIRECTORY.intValue(), 0444);
System.out.println(fd1);
int fd2 = posix.open(" file_example", OpenFlags.O_DIRECTORY.intValue(), 0444);
System.out.println(fd2);
Both fd1 and fd2 are non-negative integers. I would expect fd2 to be a negative indicating that the open failed. I see the correct behavior when using c directly.
I have also tried using:
POSIX posix = POSIXFactory.getPOSIX(new DefaultPOSIXHandler(), true);
Is this a bug?
Metadata
Metadata
Assignees
Labels
No labels