Page MenuHomeFreeBSD

D51687.1790666892.diff
No OneTemporary

Size
651 B
Referenced Files
None
Subscribers
None

D51687.1790666892.diff

diff --git a/usr.sbin/chroot/chroot.c b/usr.sbin/chroot/chroot.c
--- a/usr.sbin/chroot/chroot.c
+++ b/usr.sbin/chroot/chroot.c
@@ -34,6 +34,7 @@
#include <ctype.h>
#include <err.h>
+#include <errno.h>
#include <grp.h>
#include <limits.h>
#include <paths.h>
@@ -158,8 +159,13 @@
err(1, "procctl");
}
- if (chdir(argv[0]) == -1 || chroot(".") == -1)
+ if (chdir(argv[0]) == -1)
err(1, "%s", argv[0]);
+ if (chroot(".") == -1) {
+ if (errno == EPERM && !nonprivileged && geteuid() != 0)
+ errx(1, "unprivileged use requires -n");
+ err(1, "%s", argv[0]);
+ }
if (gids && setgroups(gids, gidlist) == -1)
err(1, "setgroups");

File Metadata

Mime Type
text/plain
Expires
Tue, Sep 29, 7:28 AM (17 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29979872
Default Alt Text
D51687.1790666892.diff (651 B)

Event Timeline