about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-06T01·24+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-06T01·24+0000
commit9f0efa6611d010bf2fb88a2f6a583c4f32fd89ac (patch)
tree275818c7792285b9fce99c9a69090f4e2c30c03f /src
parent2b558843a2228051bec475a016e7bb2565433330 (diff)
* Start of the setuid helper (the program that performs the operations
  that have to be done as root: running builders under different uids,
  changing ownership of build results, and deleting paths in the store
  with the wrong ownership).

Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/libstore/build.cc7
-rw-r--r--src/nix-setuid-helper/Makefile.am8
-rw-r--r--src/nix-setuid-helper/main.cc3
4 files changed, 17 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 92a7b6e15379..971f7d9d1c75 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,5 @@
 SUBDIRS = bin2c boost libutil libstore libmain nix-store nix-hash \
- libexpr nix-instantiate nix-env nix-worker nix-log2xml bsdiff-4.3
+ libexpr nix-instantiate nix-env nix-worker nix-setuid-helper \
+ nix-log2xml bsdiff-4.3
 
 EXTRA_DIST = aterm-helper.pl
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index cc09a101f588..0ecd8bb10712 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -454,11 +454,12 @@ static void killUser(uid_t uid)
 		if (kill(-1, SIGKILL) == 0) break;
 		if (errno == ESRCH) break; /* no more processes */
 		if (errno != EINTR)
-		    throw SysError(format("cannot kill processes for UID `%1%'") % uid);
+		    throw SysError(format("cannot kill processes for uid `%1%'") % uid);
 	    }
         
         } catch (std::exception & e) {
-            std::cerr << format("killing build users: %1%\n") % e.what();
+            std::cerr << format("killing processes beloging to uid `%1%': %1%\n")
+                % uid % e.what();
             quickExit(1);
         }
         quickExit(0);
@@ -466,7 +467,7 @@ static void killUser(uid_t uid)
     
     /* parent */
     if (pid.wait(true) != 0)
-        throw Error(format("cannot kill processes for UID `%1%'") % uid);
+        throw Error(format("cannot kill processes for uid `%1%'") % uid);
 
     /* !!! We should really do some check to make sure that there are
        no processes left running under `uid', but there is no portable
diff --git a/src/nix-setuid-helper/Makefile.am b/src/nix-setuid-helper/Makefile.am
new file mode 100644
index 000000000000..afff2bde7c13
--- /dev/null
+++ b/src/nix-setuid-helper/Makefile.am
@@ -0,0 +1,8 @@
+libexec_PROGRAMS = nix-setuid-helper
+
+nix_setuid_helper_SOURCES = main.cc
+nix_setuid_helper_LDADD = ../libutil/libutil.la \
+ ../boost/format/libformat.la ${aterm_lib}
+
+AM_CXXFLAGS = \
+ -I$(srcdir)/.. $(aterm_include) -I$(srcdir)/../libutil
diff --git a/src/nix-setuid-helper/main.cc b/src/nix-setuid-helper/main.cc
new file mode 100644
index 000000000000..ff70fa6560a8
--- /dev/null
+++ b/src/nix-setuid-helper/main.cc
@@ -0,0 +1,3 @@
+int main(int argc, char * * argv)
+{
+}