[FFmpeg-cvslog] r12607 - trunk/libavformat/mov.c

Måns Rullgård mans
Thu Mar 27 18:48:14 CET 2008


Michael Niedermayer wrote:
> On Thu, Mar 27, 2008 at 02:30:31PM +0100, bcoudurier wrote:
>> Author: bcoudurier
>> Date: Thu Mar 27 14:30:31 2008
>> New Revision: 12607
>>
>> Log:
>> print essence path in error message
>>
>> Modified:
>>    trunk/libavformat/mov.c
>>
>> Modified: trunk/libavformat/mov.c
>> ==============================================================================
>> --- trunk/libavformat/mov.c	(original)
>> +++ trunk/libavformat/mov.c	Thu Mar 27 14:30:31 2008
>> @@ -1259,8 +1259,8 @@ static int mov_read_trak(MOVContext *c,
>>
>>      if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
>>          if (url_fopen(&sc->pb, sc->drefs[sc->dref_id-1].path, URL_RDONLY) < 0)
>> -            av_log(c->fc, AV_LOG_ERROR, "stream %d, error opening external
>> essence: %s\n",
>> -                   st->index, strerror(errno));
>> +            av_log(c->fc, AV_LOG_ERROR, "stream %d, error opening file %s:
>> %s\n",
>> +                   st->index, sc->drefs[sc->dref_id-1].path, strerror(errno));
>
> not related to this commit but we cannot call strerror()
> The docs say:
>  -- Function: char * strerror (int ERRNUM)
> [...]
>      You should not modify the string returned by `strerror'.  Also, if
>      you make subsequent calls to `strerror', the string might be
>      overwritten.  (But it's guaranteed that no library function ever
>                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>      calls `strerror' behind your back.)
>      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I don't know where you found that.  It looks a bit like the glibc info
page.  When quoting standards, please go the to real text.

The C99 standard has this text:

  The implementation shall behave as if no library function calls the
  strerror function.

POSIX is a bit more specific:

  The implementation shall behave as if no function defined in this
  volume of IEEE Std 1003.1-2001 calls strerror().

In both cases, it is clear that the meaning is that no libc function
will ever call strerror().  This does not forbid other libraries
using it.

That said, it is of course good practise of any library to not modify
global state, so we should avoid using strerror().

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-cvslog mailing list