Message-Id: <199902242108.VAA15328@out5.ibm.net> From: "Mark E." To: djgpp-workers AT delorie DOT com Date: Wed, 24 Feb 1999 14:25:09 -0500 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: patches for chroot References: <199902230504 DOT FAA82404 AT out1 DOT ibm DOT net> In-reply-to: X-mailer: Pegasus Mail for Win32 (v3.01d) Reply-To: djgpp-workers AT delorie DOT com > > chroot ("c:/djgpp") > > getcwd would then return '/bin' if the cwd is 'c:/djgpp/bin'. > > Yes. > > I think _fixpath should do that as well, to prevent confusion, and also to > be compatible with Unix description that every call to chroot interprets > its argument *relative to the previous root*. > I've run into a problem with stat() and _fixpath. void foo() { struct stat finfo; chroot ("c:/djgpp"); if (stat ("c:/djgpp/bin", &finfo) < 0) return -1; } The call to stat() fails because "c:/djgpp" is stripped so all it gets back is "/bin" and since a call to _put_path is inappropriate, the root expansion doesn't take place. There's also the case of chroot ("c:/djgpp"); stat ("/bin", &finfo); that fails for a similiar reason. One solution would be to have a flag for _fixpath to tell it when not to delete the root path from the output. I suppose another would be to not delete the root path from the output at all, but it was said above we want _fixpath to do that. Thoughts? Mark BTW, Thanks Nate for running the chroot test. --- Mark Elbrecht snowball3 AT usa DOT net http://members.xoom.com/snowball3/