Control: tag -1 moreinfo

On Fri, Jul 15, 2016 at 22:14:53 +0200, Joel Rosdahl wrote:

> @@ -1745,8 +1747,17 @@
>                       goto out;
>               }
>  
> -             /* Rewrite to relative to increase hit rate. */
> -             input_file = make_relative_path(x_strdup(argv[i]));
> +             lstat(argv[i], &st);
> +             if (S_ISLNK(st.st_mode)) {
> +                     /* Don't rewrite source file path if it's a symlink 
> since
> +                        make_relative_path resolves symlinks using 
> realpath(3) and this leads
> +                        to potentially choosing incorrect relative header 
> files. See the
> +                        "symlink to source file" test. */
> +                     input_file = x_strdup(argv[i]);
> +             } else {
> +                     /* Rewrite to relative to increase hit rate. */
> +                     input_file = make_relative_path(x_strdup(argv[i]));
> +             }
>       }
>  
>       if (!input_file) {

It doesn't look like you're doing any error checking from lstat; is
there no way it'll fail here?

Cheers,
Julien

Reply via email to