[PATCH] realpath stack usage 8k -> 4k

Denys Vlasenko vda.linux at googlemail.com
Thu May 8 13:55:06 UTC 2008


On Thursday 08 May 2008 11:12, Carmelo AMOROSO wrote:
> Hi Denys,
> I looked better at realpath man page and your implementation...
> well I think that we should only fix the test not testing for buffer 
> contents (that in undefined)
> when the realpath fails... so i'd use 'result' instead of test[i].out or 
> test[i].resolved...
> something like that
> 
> -      if (!check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved))
> +      if (result && !check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved))
>  	{
>  	  printf ("%s: flunked test %d (expected resolved `%s', got `%s')\n",
>  		  argv[0], i, tests[i].out ? tests[i].out : tests[i].resolved,
> 
> So, if realpath return result==NULL (it means it is failing), then
> do not check buffern content and go on to check the errno for ELOOP
> 
> Do you agree ?

Yes.

I committed the fix to svn.
I also renamed struct fields to more closely explain what they mean.
Another change is to check errno always, regardless of NULL return.
This last change found a bug in realpath - also fixed now.
--
vda



More information about the uClibc mailing list