[PATCH] File name too long causing failure to open temporary head file in dlltool
Jan Beulich
jbeulich@suse.com
Tue Aug 13 08:04:52 GMT 2024
On 13.08.2024 04:31, jiaying.song.cn@windriver.com wrote:
> --- a/binutils/dlltool.c
> +++ b/binutils/dlltool.c
> @@ -4099,11 +4099,18 @@ main (int ac, char **av)
> if (imp_name || delayimp_name)
> {
> const char *input = imp_name ? imp_name : delayimp_name;
> - tmp_prefix = xmalloc (strlen (input) + 2);
> - sprintf (tmp_prefix, "%s_", input);
> - for (i = 0; tmp_prefix[i]; i++)
> - if (!ISALNUM (tmp_prefix[i]))
> - tmp_prefix[i] = '_';
> + if ((strlen(input) + 2) > NAME_MAX)
> + {
> + tmp_prefix = prefix_encode ("d", getpid ());
I think it would be nice if this function invocation would be folded
with the other one, just out of patch context (as long as that's easy
to arrange for, which it looks like it is).
> + }
> + else
> + {
> + tmp_prefix = xmalloc (strlen (input) + 2);
> + sprintf (tmp_prefix, "%s_", input);
> + for (i = 0; tmp_prefix[i]; i++)
> + if (!ISALNUM (tmp_prefix[i]))
> + tmp_prefix[i] = '_';
Please don't screw up indentation. (I notice the whole code block
suffers from the lack of use of hard tabs. As - for the comment
above - you'll re-arrange it anyway, please can you take care of
that as well at the same time?)
Jan
> + }
> }
> else
> {
More information about the Binutils
mailing list