[PATCH 1/2 V2] gas/as.c: print input and output filenames when error

Robert Yang liezhi.yang@windriver.com
Thu Aug 9 10:43:00 GMT 2018



On 08/09/2018 06:41 PM, Jan Beulich wrote:
>>>> On 09.08.18 at 12:37, <liezhi.yang@windriver.com> wrote:
> 
>>
>> On 08/09/2018 06:25 PM, Jan Beulich wrote:
>>>>>> On 09.08.18 at 12:21, <liezhi.yang@windriver.com> wrote:
>>>> --- a/gas/as.c
>>>> +++ b/gas/as.c
>>>> @@ -1259,8 +1259,10 @@ main (int argc, char ** argv)
>>>>    	      if (sib.st_ino == sob.st_ino && sib.st_ino != 0)
>>>>    		{
>>>>    		  /* Don't let as_fatal remove the output file!  */
>>>> +		  saved_out_file_name = xstrdup (out_file_name);
>>>
>>> Actually - why xstrdup()? And why to a global variable?
>>
>> The complete code is:
>>
>> [snip]
>>             saved_out_file_name = xstrdup (out_file_name);
>>             out_file_name = NULL;
>>             as_fatal (_("The input '%s' and output '%s' have the same inode"),
>>                  argv[i], saved_out_file_name);
>> [snip]
>>
>> The out_file_name is set to NULL before as_fatal(), so I need a var to save it,
>> and it is similar to out_file_name, so I simulated it.
> 
> But you can use a local variable, and you can simply assign the
> value of out_file_name, instead of doing another allocation.

Thanks, I will update it.

// Robert

> 
> Jan
> 
> 
> 



More information about the Binutils mailing list