systemd/0010-test-seccomp-fix-compilation-on-arm64.patch

39 lines
1.3 KiB
Diff
Raw Normal View History

2019-04-03 14:45:51 +00:00
From dff6c6295b1cb09d6da8ab054e66059e43247ab1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 3 Apr 2019 12:36:03 +0200
Subject: [PATCH 10/11] test-seccomp: fix compilation on arm64
It has no open().
---
src/test/test-seccomp.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/test/test-seccomp.c b/src/test/test-seccomp.c
index 8efbecbeff..9b7307cf39 100644
--- a/src/test/test-seccomp.c
+++ b/src/test/test-seccomp.c
@@ -7,6 +7,7 @@
#include <sys/mman.h>
#include <sys/personality.h>
#include <sys/shm.h>
+#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
@@ -763,9 +764,14 @@ static void test_lock_personality(void) {
static int real_open(const char *path, int flags, mode_t mode) {
/* glibc internally calls openat() when open() is requested. Let's hence define our own wrapper for
- * testing purposes that calls the real syscall. */
+ * testing purposes that calls the real syscall, on architectures where SYS_open is defined. On
+ * other architectures, let's just fall back to the glibc call. */
+#ifdef SYS_open
return (int) syscall(SYS_open, path, flags, mode);
+#else
+ return open(path, flags, mode);
+#endif
}
static void test_restrict_suid_sgid(void) {