diff mbox series

[FFmpeg-devel,03/60] fftools/opt_common: use av_err2str instead of strerror

Message ID D41CE2FHV7P4.17BEVFY3V656Y@gmail.com
State Withdrawn
Headers show
Series [FFmpeg-devel,01/60] fftools/ffmpeg_opt: fix variable shadowing | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marvin Scholz Sept. 8, 2024, 5:46 p.m. UTC
The strerror function must not be used here, as the error is a AVERROR
errno, which depending on the platform no longer corresponds to the
actual errno that can be handled by strerror.
---
 fftools/opt_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Rheinhardt Sept. 9, 2024, 1:30 a.m. UTC | #1
Marvin Scholz:
> The strerror function must not be used here, as the error is a AVERROR
> errno, which depending on the platform no longer corresponds to the
> actual errno that can be handled by strerror.
> ---
>  fftools/opt_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fftools/opt_common.c b/fftools/opt_common.c
> index 059f7a53d2..dc5fc7b96d 100644
> --- a/fftools/opt_common.c
> +++ b/fftools/opt_common.c
> @@ -1207,7 +1207,7 @@ int init_report(const char *env, FILE **file)
>      if (!report_file) {
>          int err = AVERROR(errno);
>          av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n",
> -               filename.str, strerror(errno));
> +               filename.str, av_err2str(errno));
>          return err;
>      }
>      av_log_set_callback(log_callback_report);

The code uses strerror(errno) and not strerror(err), so I don't get the
rationale for this commit.

- Andreas
Marvin Scholz Sept. 9, 2024, 1:39 a.m. UTC | #2
On 9 Sep 2024, at 3:30, Andreas Rheinhardt wrote:

> Marvin Scholz:
>> The strerror function must not be used here, as the error is a AVERROR
>> errno, which depending on the platform no longer corresponds to the
>> actual errno that can be handled by strerror.
>> ---
>>  fftools/opt_common.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fftools/opt_common.c b/fftools/opt_common.c
>> index 059f7a53d2..dc5fc7b96d 100644
>> --- a/fftools/opt_common.c
>> +++ b/fftools/opt_common.c
>> @@ -1207,7 +1207,7 @@ int init_report(const char *env, FILE **file)
>>      if (!report_file) {
>>          int err = AVERROR(errno);
>>          av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n",
>> -               filename.str, strerror(errno));
>> +               filename.str, av_err2str(errno));
>>          return err;
>>      }
>>      av_log_set_callback(log_callback_report);
>
> The code uses strerror(errno) and not strerror(err), so I don't get the
> rationale for this commit.

Noticed that as well when looking through the patches again before sending
but apparently forgot to drop it…

Dropped locally now, thanks.

>
> - Andreas
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 059f7a53d2..dc5fc7b96d 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -1207,7 +1207,7 @@  int init_report(const char *env, FILE **file)
     if (!report_file) {
         int err = AVERROR(errno);
         av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n",
-               filename.str, strerror(errno));
+               filename.str, av_err2str(errno));
         return err;
     }
     av_log_set_callback(log_callback_report);