From a82d80ddeb6f68ff136124dfb591a404bb195ea3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 7 Dec 2006 16:40:41 +0000 Subject: * Move setuidCleanup() to libutil. --- src/libmain/setuid-common.hh | 22 ---------------------- src/libmain/shared.cc | 3 --- 2 files changed, 25 deletions(-) delete mode 100644 src/libmain/setuid-common.hh (limited to 'src/libmain') diff --git a/src/libmain/setuid-common.hh b/src/libmain/setuid-common.hh deleted file mode 100644 index a3e840996161..000000000000 --- a/src/libmain/setuid-common.hh +++ /dev/null @@ -1,22 +0,0 @@ -/* Code shared between libmain and nix-setuid-helper. */ - -extern char * * environ; - - -namespace nix { - - -void setuidCleanup() -{ - /* Don't trust the environment. */ - environ = 0; - - /* Make sure that file descriptors 0, 1, 2 are open. */ - for (int fd = 0; fd <= 2; ++fd) { - struct stat st; - if (fstat(fd, &st) == -1) abort(); - } -} - - -} diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index fa72ca5bc444..d7fb240192b6 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -14,9 +14,6 @@ #include -#include "setuid-common.hh" - - namespace nix { -- cgit 1.4.1