xbps-uunshare: do not fail if /proc/self/setgroups does not exist.

3.16 supports user_namespaces(7) but does not have /proc/self/setgroups.

Found by @cheneukirchen.
This commit is contained in:
Juan RP 2015-03-09 12:34:57 +01:00
parent be363d93f5
commit 1597727814
2 changed files with 8 additions and 6 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.44.1 (???):
* xbps-uunshare(8): do not fail if we cannot disable setgroups; some kernels
might not support it. Found by @cheneukirchen on 3.16.
* xbps-reconfigure(8): added -i/--ignore to usage(), by Christian Neukirchen.
* Updated zsh completions, by Christian Neukirchen.

View File

@ -147,12 +147,11 @@ main(int argc, char **argv)
close(fd);
if ((fd = open("/proc/self/setgroups", O_RDWR)) == -1)
die("failed to open /proc/self/setgroups rw");
if (write(fd, "deny", 4) == -1)
die("failed to write to /proc/self/setgroups");
close(fd);
if ((fd = open("/proc/self/setgroups", O_RDWR)) == 0) {
if (write(fd, "deny", 4) == -1)
die("failed to write to /proc/self/setgroups");
close(fd);
}
if ((fd = open("/proc/self/gid_map", O_RDWR)) == -1)
die("failed to open /proc/self/gid_map rw");