summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Karcher <github@mkarcher.dialup.fu-berlin.de>2020-08-20 16:43:43 +0200
committerPaul Moore <paul@paul-moore.com>2020-09-01 12:05:48 -0400
commitf0686d9de911e7ffcdc7364566c1d146e44657c2 (patch)
treed847ef1975cd3ddc00df3f2be0d3a6b11df673a8 /tests
parenta317fabc1fd915f19f7e7326bf7dcb77493f1210 (diff)
downloadlibseccomp-f0686d9de911e7ffcdc7364566c1d146e44657c2.tar.gz
tests: use smaller "magic" numbers in 58-live-tsync_notify
This fix is performing the same changes bee43d3e884788569860a384e6a38357785a3995 was doing on test 51-live-user_notification on test 58-live-tsync_notify. Signed-off-by: Michael Karcher <github@mkarcher.dialup.fu-berlin.de> Acked-by: Tom Hromatka <tom.hromatka@oracle.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/58-live-tsync_notify.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/58-live-tsync_notify.c b/tests/58-live-tsync_notify.c
index 86e1b0c..e071284 100644
--- a/tests/58-live-tsync_notify.c
+++ b/tests/58-live-tsync_notify.c
@@ -21,6 +21,7 @@
#include <sys/types.h>
#include <sys/wait.h>
+#include <asm/unistd.h>
#include <unistd.h>
#include <seccomp.h>
#include <signal.h>
@@ -30,15 +31,15 @@
#include "util.h"
-#define MAGIC 0x1122334455667788UL
-
int main(int argc, char *argv[])
{
int rc, fd = -1, status;
struct seccomp_notif *req = NULL;
struct seccomp_notif_resp *resp = NULL;
scmp_filter_ctx ctx = NULL;
- pid_t pid = 0;
+ pid_t pid = 0, magic;
+
+ magic = getpid();
ctx = seccomp_init(SCMP_ACT_ALLOW);
if (ctx == NULL)
@@ -63,7 +64,7 @@ int main(int argc, char *argv[])
pid = fork();
if (pid == 0)
- exit(syscall(SCMP_SYS(getpid)) != MAGIC);
+ exit(syscall(__NR_getpid) != magic);
rc = seccomp_notify_alloc(&req, &resp);
if (rc)
@@ -72,7 +73,7 @@ int main(int argc, char *argv[])
rc = seccomp_notify_receive(fd, req);
if (rc)
goto out;
- if (req->data.nr != SCMP_SYS(getpid)) {
+ if (req->data.nr != __NR_getpid) {
rc = -EFAULT;
goto out;
}
@@ -81,7 +82,7 @@ int main(int argc, char *argv[])
goto out;
resp->id = req->id;
- resp->val = MAGIC;
+ resp->val = magic;
resp->error = 0;
resp->flags = 0;
rc = seccomp_notify_respond(fd, resp);