Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions tests/zfs-tests/tests/functional/tmpfile/setup.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@

. $STF_SUITE/include/libtest.shlib

if ! $STF_SUITE/tests/functional/tmpfile/tmpfile_test /tmp; then
log_unsupported "The kernel doesn't support O_TMPFILE."
DISK=${DISKS%% *}
default_setup_noexit $DISK

if ! $STF_SUITE/tests/functional/tmpfile/tmpfile_test $TESTDIR; then
default_cleanup_noexit
log_unsupported "The kernel/filesystem doesn't support O_TMPFILE"
fi

DISK=${DISKS%% *}
default_setup $DISK
log_pass
11 changes: 6 additions & 5 deletions tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ main(int argc, char *argv[])

fd = open(argv[1], O_TMPFILE | O_WRONLY, 0666);
if (fd < 0) {
/*
* Only fail on EISDIR. If we get EOPNOTSUPP, that means
* kernel support O_TMPFILE, but the path at argv[1] doesn't.
*/
if (errno == EISDIR) {
fprintf(stderr, "kernel doesn't support O_TMPFILE\n");
fprintf(stderr,
"The kernel doesn't support O_TMPFILE\n");
return (1);
} else if (errno == EOPNOTSUPP) {
fprintf(stderr,
"The filesystem doesn't support O_TMPFILE\n");
return (2);
}
perror("open");
} else {
Expand Down