This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]