Denys Vlasenko wrote:
> On Wednesday 07 May 2008 21:06, Denys Vlasenko wrote:
>   
> [SNIP]
>
>   
>> or to stop testing buffer's contents?
>>     
>
> this way:
>
> --- test-canon-old.c  Wed May  7 21:22:49 2008
> +++ test-canon.c      Wed May  7 21:25:14 2008
> @@ -72,17 +72,9 @@
>    {"foobar",                         0, "./foobar", ENOENT},
>    {".",                                      "."},
>    {"./foobar",                               0, "./foobar", ENOENT},
> -#ifdef __UCLIBC__
> -  /* we differ from glibc here, but POSIX allows it as it says that if we did
> -   * not successfuly complete, the value of resolved_path is undefined */
> -  {"SYMLINK_LOOP",                   0, "", ELOOP},
> +  {"SYMLINK_LOOP",                   0, 0, ELOOP},
>    /* 15 */
> -  {"./SYMLINK_LOOP",                 0, "", ELOOP},
> -#else
> -  {"SYMLINK_LOOP",                   0, "./SYMLINK_LOOP", ELOOP},
> -  /* 15 */
> -  {"./SYMLINK_LOOP",                 0, "./SYMLINK_LOOP", ELOOP},
> -#endif
> +  {"./SYMLINK_LOOP",                 0, 0, ELOOP},
>    {"SYMLINK_1",                              "."},
>    {"SYMLINK_1/foobar",                       0, "./foobar", ENOENT},
>    {"SYMLINK_2",                              "/etc"},
> @@ -191,7 +183,8 @@
>         continue;
>       }
>  
> -      if (!check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved))
> +      if ((tests[i].out || tests[i].resolved)
> +       && !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,
>
>
>   
>> Your pick. 
>>     
>
> --
> vda
>   
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 ?

Let's keep your implementation for realpath ;-)
Thanks,
Carmelo

_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to