From da037d7196537768294130227dc0515392d97211 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Tue, 30 Apr 2013 03:56:44 +0400 Subject: debianutils (4.3.4+dyson1) unstable; urgency=low * Package for Dyson * ischroot() now supports illumos/solaris (like on linux) --- debian/changelog | 7 +++++++ ischroot.c | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/debian/changelog b/debian/changelog index 7a861f6..21fae1d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +debianutils (4.3.4+dyson1) unstable; urgency=low + + * Package for Dyson + * ischroot() now supports illumos/solaris (like on linux) + + -- Igor Pashev Tue, 30 Apr 2013 03:55:35 +0400 + debianutils (4.3.4) unstable; urgency=low [ David Prévot ] diff --git a/ischroot.c b/ischroot.c index bed67f9..7da07a8 100644 --- a/ischroot.c +++ b/ischroot.c @@ -152,6 +152,26 @@ static int ischroot() return 0; } +#elif defined (__sun__) + +/* Similar to Linux + * XXX: check zone? + * XXX: illumos kernel automatically mounts /proc on boot + */ + +static int ischroot() +{ + struct stat st1, st2; + + if (stat("/", &st1)) + return 2; + if (stat("/proc/1/root", &st2)) + return 2; + if ((st1.st_dev == st2.st_dev) && (st1.st_ino == st2.st_ino)) + return 1; + return 0; +} + #else static int ischroot() -- cgit v1.2.3