From a043f8e14d9e5f80124e34f6fde322760ff2cb71 Mon Sep 17 00:00:00 2001
|
From: Khem Raj <raj.khem@gmail.com>
|
Date: Wed, 13 Feb 2019 09:51:14 -0800
|
Subject: [PATCH] Define TEMP_FAILURE_RETRY and __si_fields
|
|
__si_fields is defined for non-glibc systems
|
TEMP_FAILURE_RETRY is defined if its not already defined
|
|
Upstream-Status: Pending
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
---
|
sandbox/linux/seccomp-bpf/trap.cc | 5 +++++
|
sandbox/linux/suid/sandbox.c | 9 +++++++++
|
2 files changed, 14 insertions(+)
|
|
diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
|
index f5b86a73ac..6a08b6d08d 100644
|
--- a/sandbox/linux/seccomp-bpf/trap.cc
|
+++ b/sandbox/linux/seccomp-bpf/trap.cc
|
@@ -25,6 +25,11 @@
|
#include "sandbox/linux/system_headers/linux_seccomp.h"
|
#include "sandbox/linux/system_headers/linux_signal.h"
|
|
+// musl libc defines siginfo_t __si_fields instead of _sifields
|
+#if defined(__linux__) && !defined(__GLIBC__)
|
+#define _sifields __si_fields
|
+#endif
|
+
|
namespace {
|
|
struct arch_sigsys {
|
diff --git a/sandbox/linux/suid/sandbox.c b/sandbox/linux/suid/sandbox.c
|
index 5fdb4817af..09b81ef7e4 100644
|
--- a/sandbox/linux/suid/sandbox.c
|
+++ b/sandbox/linux/suid/sandbox.c
|
@@ -44,6 +44,15 @@
|
|
static bool DropRoot();
|
|
+#ifndef TEMP_FAILURE_RETRY
|
+#define TEMP_FAILURE_RETRY(expression) \
|
+ (__extension__ \
|
+ ({ long int __result; \
|
+ do __result = (long int) (expression); \
|
+ while (__result == -1L && errno == EINTR); \
|
+ __result; }))
|
+#endif
|
+
|
#define HANDLE_EINTR(x) TEMP_FAILURE_RETRY(x)
|
|
static void FatalError(const char* msg, ...)
|