about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-05-03T08·44+0200
committerEelco Dolstra <edolstra@gmail.com>2019-05-03T08·48+0200
commitf9a2ea44867cd1dbb408bca4df0ced806137b7f7 (patch)
treef0dcb7d07f3006fbebd7ea0ce30a7783423bd329 /src/libutil
parent989cb3777753024072160776ea37348689b89d44 (diff)
Fix "Bad system call" running i686-linux binaries on x86_64-linux
To determine which seccomp filters to install, we were incorrectly
using settings.thisSystem, which doesn't denote the actual system when
--system is used.

Fixes #2791.
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/util.cc3
-rw-r--r--src/libutil/util.hh4
2 files changed, 7 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index e3dcd246c681..a7170566533e 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -38,6 +38,9 @@ extern char * * environ;
 namespace nix {
 
 
+const std::string nativeSystem = SYSTEM;
+
+
 BaseError & BaseError::addPrefix(const FormatOrString & fs)
 {
     prefix_ = fs.s + prefix_;
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 9f239bff371a..54936a5cb10b 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -30,6 +30,10 @@ struct Sink;
 struct Source;
 
 
+/* The system for which Nix is compiled. */
+extern const std::string nativeSystem;
+
+
 /* Return an environment variable. */
 string getEnv(const string & key, const string & def = "");