Hi,

On Sun, 2022-12-18 at 00:52 +0800, Yonggang Luo via Elfutils-devel
wrote:
> diff --git a/libdw/dwarf_getsrc_file.c b/libdw/dwarf_getsrc_file.c
> index 5289c7da..884fea32 100644
> --- a/libdw/dwarf_getsrc_file.c
> +++ b/libdw/dwarf_getsrc_file.c
> @@ -98,7 +98,7 @@ dwarf_getsrc_file (Dwarf *dbg, const char *fname, int 
> lineno, int column,
>             /* Match the name with the name the user provided.  */
>             const char *fname2 = line->files->info[lastfile].name;
>             if (is_basename)
> -             lastmatch = strcmp (basename (fname2), fname) == 0;
> +             lastmatch = strcmp (basename ((char *)fname2), fname) == 0;
>             else
>               lastmatch = strcmp (fname2, fname) == 0;
>           }

I think the reason you need these casts is because you are somehow
getting the wrong basename function. We use the GNU one which doesn't
manipulate the given string. See
https://www.man7.org/linux/man-pages/man3/basename.3.html#NOTES

Cheers,

Mark

Reply via email to