Skip to content

Commit

Permalink
Use RR_ constants so we build on systems without SYS_openat2
Browse files Browse the repository at this point in the history
  • Loading branch information
rocallahan committed Dec 26, 2023
1 parent 4567023 commit 98991b9
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/test/openat2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

#include "util.h"

#include <fcntl.h> /* Definition of O_* and S_* constants */
#include <sys/syscall.h> /* Definition of SYS_* constants */
#include <unistd.h>
#include <errno.h>

#define TEST_DIR "test_dir"
#define FILENAME "foo"
#define REL_FILENAME "../" TEST_DIR "/" FILENAME
Expand All @@ -25,7 +20,7 @@ int main(void) {
how.mode = 0600;

how.resolve = RESOLVE_BENEATH;
filefd = syscall(SYS_openat2, dirfd, REL_FILENAME, &how, sizeof(how));
filefd = syscall(RR_openat2, dirfd, REL_FILENAME, &how, sizeof(how));
test_assert(filefd == -1);

// openat2 was introduced by Linux 5.6
Expand All @@ -38,7 +33,7 @@ int main(void) {
test_assert(errno == EXDEV);

how.resolve = 0;
filefd = syscall(SYS_openat2, dirfd, REL_FILENAME, &how, sizeof(how));
filefd = syscall(RR_openat2, dirfd, REL_FILENAME, &how, sizeof(how));
test_assert(filefd > 0);
test_assert(close(filefd) == 0);

Expand Down

0 comments on commit 98991b9

Please sign in to comment.