[PATCH 0/3] binutils: read from stdin if input file is -

Nick Clifton nickc@redhat.com
Tue Feb 20 15:09:00 GMT 2018


Hi Ahmad,

>> Speaking of which:
>>
>> +          nbfd->temp_filename = make_temp_file (NULL);
>>
>> You need to check to see if make_temp_file() returned NULL here...
> make_temp_file aborts the process (via xmalloc) if it fails to allocate, so NULL check is superfluous.

Ah - I was going by the comment in libiberty.h:

  /* Return a temporary file name or NULL if unable to create one.  */

  extern char *make_temp_file (const char *) ATTRIBUTE_MALLOC;

And the libiberty info documentation:

  -- Replacement: char* make_temp_file (const char *SUFFIX)

     Return a temporary file name (as a string) or 'NULL' if unable to
     create one.  SUFFIX is a suffix to append to the file name.  The
     string is 'malloc'ed, and the temporary file has been created.

I guess that the header file and documentation are out of date.

Cheers
  Nick



More information about the Binutils mailing list