commit 307b5c0873d9e556f0e9cb94ef2b1515c46ab254
parent 9f8c0ab378171c8175d55727e6d920c784d63439
Author: Gerrit Pape <pape@smarden.org>
Date: Fri, 30 Apr 2004 18:51:26 +0000
chdir before chroot.
Diffstat:
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/package/CHANGES b/package/CHANGES
@@ -1,3 +1,5 @@
+ * chpst.c: new option -/ chroot.
+
runit 1.0.2
Mon, 29 Mar 2004 17:52:50 +0000
* man/svlogd.8: timestamps are not considered when matching patterns (thx
diff --git a/src/chpst.c b/src/chpst.c
@@ -303,7 +303,10 @@ int main(int argc, const char *const *argv) {
if (pgrp) setsid();
if (env_dir) edir(env_dir);
- if (root) if (chroot(root) == -1) fatal("unable to change root directory");
+ if (root) {
+ if (chdir(root) == -1) fatal2("unable to change directory", root);
+ if (chroot(".") == -1) fatal("unable to change root directory");
+ }
if (env_user) euidgid(env_user, 1);
if (set_user) suidgid(set_user, 1);
slimit();