Subject: Re: bin/19377
To: Emmanuel Dreyfus <manu@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 12/16/2002 15:43:27
On Mon, Dec 16, 2002 at 12:46:26AM +0100, Emmanuel Dreyfus wrote:
> Hi all
> 
> I'd like some review on bin/19377 before committing the fix...

Well strncpy() doesn't DTRT, strlcpy() probably does what you
intended.  OTOH there is no real reason to enforce MAXPATHLEN here.

Looks like pwd could be:
	char *wd = getcwd(0, 0);
	replydirname(wd ? wd : cached_path, "is the current directory.")
	free(wd);
(it maybe even true that you could always used cached_path here.)

I wouldn't have written the // /./ and /../ removal that way either.

Actually, if you are going to shorten // etc, you might as well
do the readlink() calls on each component and do the cd() directeory
by directory.  But maybe that is excessive...
(Given what getcwd() has to go through, the above is probably
faster!)

	David

-- 
David Laight: david@l8s.co.uk