cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
Blob Blame History Raw
From bbea32299156308ba51a447dc775f320fe3c459b Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
Date: Sun, 7 Sep 2014 00:16:18 +0100
Subject: [PATCH 188/189] setarch: use personality() system call when it is
 available

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1690102
Upstream: http://github.com/karelzak/util-linux/commit/9ed11cc260a28a64de0c1fa5d94d7cd6273781a5
---
 sys-utils/setarch.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index b03406dd3..bcde78f4c 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -24,8 +24,7 @@
  * sparc32 util by Jakub Jelinek (1998, 1999)
  */
 
-#include <syscall.h>
-#include <linux/personality.h>
+#include <sys/personality.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
@@ -37,7 +36,11 @@
 #include "c.h"
 #include "closestream.h"
 
-#define set_pers(pers) ((long)syscall(SYS_personality, pers))
+#ifndef HAVE_PERSONALITY
+# include <syscall.h>
+# define personality(pers) ((long)syscall(SYS_personality, pers))
+#endif
+
 
 /* Options without equivalent short options */
 enum {
@@ -220,7 +223,7 @@ set_arch(const char *pers, unsigned long options, int list)
     errx(EXIT_FAILURE, _("%s: Unrecognized architecture"), pers);
 
   pers_value = transitions[i].perval | options;
-  if (set_pers(pers_value) == -EINVAL)
+  if (personality(pers_value) == -EINVAL)
     return 1;
 
   uname(&un);
-- 
2.21.0