Re: RFC: avoid chroot() call if not changing root dir
From:
Bernhard Voelker
Subject:
Re: RFC: avoid chroot() call if not changing root dir
Date:
Sat, 17 May 2014 02:03:22 +0200
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
On 05/16/2014 11:02 PM, PƔdraig Brady wrote:
> Pushed.
Sorry, a bit late ...
> + /* Only do chroot specific actions if actually changing root.
> + The main difference here is that we don't change working dir. */
> + if (! STREQ (argv[optind], "/"))
What about canonicalizing argv[optind] ?
Or do we want the ability to force chroot(2) like this:
$ src/chroot / env pwd
/home/berny/git/coreutils
$ src/chroot /. env pwd
src/chroot: cannot change root directory to /.: Operation not permitted
Probably this might be bit confusing - while some other guys
might use this difference to check for superuser privileges ...
... and fall over once we'll fix this.
Thanks & have a nice day,
Berny