dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
4aa97a
From bbea32299156308ba51a447dc775f320fe3c459b Mon Sep 17 00:00:00 2001
4aa97a
From: Sami Kerola <kerolasa@iki.fi>
4aa97a
Date: Sun, 7 Sep 2014 00:16:18 +0100
4aa97a
Subject: [PATCH 188/189] setarch: use personality() system call when it is
4aa97a
 available
4aa97a
4aa97a
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4aa97a
Signed-off-by: Karel Zak <kzak@redhat.com>
4aa97a
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1690102
4aa97a
Upstream: http://github.com/karelzak/util-linux/commit/9ed11cc260a28a64de0c1fa5d94d7cd6273781a5
4aa97a
---
4aa97a
 sys-utils/setarch.c | 11 +++++++----
4aa97a
 1 file changed, 7 insertions(+), 4 deletions(-)
4aa97a
4aa97a
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
4aa97a
index b03406dd3..bcde78f4c 100644
4aa97a
--- a/sys-utils/setarch.c
4aa97a
+++ b/sys-utils/setarch.c
4aa97a
@@ -24,8 +24,7 @@
4aa97a
  * sparc32 util by Jakub Jelinek (1998, 1999)
4aa97a
  */
4aa97a
 
4aa97a
-#include <syscall.h>
4aa97a
-#include <linux/personality.h>
4aa97a
+#include <sys/personality.h>
4aa97a
 #include <unistd.h>
4aa97a
 #include <stdio.h>
4aa97a
 #include <string.h>
4aa97a
@@ -37,7 +36,11 @@
4aa97a
 #include "c.h"
4aa97a
 #include "closestream.h"
4aa97a
 
4aa97a
-#define set_pers(pers) ((long)syscall(SYS_personality, pers))
4aa97a
+#ifndef HAVE_PERSONALITY
4aa97a
+# include <syscall.h>
4aa97a
+# define personality(pers) ((long)syscall(SYS_personality, pers))
4aa97a
+#endif
4aa97a
+
4aa97a
 
4aa97a
 /* Options without equivalent short options */
4aa97a
 enum {
4aa97a
@@ -220,7 +223,7 @@ set_arch(const char *pers, unsigned long options, int list)
4aa97a
     errx(EXIT_FAILURE, _("%s: Unrecognized architecture"), pers);
4aa97a
 
4aa97a
   pers_value = transitions[i].perval | options;
4aa97a
-  if (set_pers(pers_value) == -EINVAL)
4aa97a
+  if (personality(pers_value) == -EINVAL)
4aa97a
     return 1;
4aa97a
 
4aa97a
   uname(&un;;
4aa97a
-- 
4aa97a
2.21.0
4aa97a