summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-04-30 03:56:44 +0400
committerIgor Pashev <pashev.igor@gmail.com>2013-04-30 03:56:44 +0400
commitda037d7196537768294130227dc0515392d97211 (patch)
treec8bc673263463921d9fd5f1946dabb180e3f254f
parent8fb496f15292ac92beeab0057329442e3d443052 (diff)
downloaddebianutils-master.tar.gz
debianutils (4.3.4+dyson1) unstable; urgency=lowHEADmaster
* Package for Dyson * ischroot() now supports illumos/solaris (like on linux)
-rw-r--r--debian/changelog7
-rw-r--r--ischroot.c20
2 files changed, 27 insertions, 0 deletions
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 <pashev.igor@gmail.com> 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()