aboutsummaryrefslogtreecommitdiff
path: root/src/nix/main.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-08-09 00:58:38 +0200
committereldritch horrors <pennae@lix.systems>2024-08-09 11:33:09 +0000
commitbaa4fda34032373f2e4d5fdb5565132522c24983 (patch)
treebc7b83c92cd913a3bad6c6ac5ab9b428ef66f6ce /src/nix/main.cc
parent6491cde997297bf0e8b8c685d52792785e8980f3 (diff)
main: require argv[0]
sure, linux has been providing argv[0] by default for a while now. other OSes may not be as forthcoming though, and relying on the OS to create a world in which we can just make assumptions we could test for instead is unnecessarily lazy. we *could* default argv0, but that's a little silly. notably we abort instead of returning normally to avoid confusions where a caller interprets our exit status like a Worker build results bitmask. Change-Id: Id73f8cd0a630293b789c59a8c4b0c4a2b936b505
Diffstat (limited to 'src/nix/main.cc')
-rw-r--r--src/nix/main.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc
index 981aa2fc5..1c1e9df7e 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -503,6 +503,11 @@ void mainWrapped(int argc, char * * argv)
int main(int argc, char * * argv)
{
+ if (argc < 1) {
+ std::cerr << "no, we don't have pkexec at home. provide argv[0]." << std::endl;
+ std::abort();
+ }
+
// Increase the default stack size for the evaluator and for
// libstdc++'s std::regex.
nix::setStackSize(64 * 1024 * 1024);