mirror of
https://github.com/librempeg/librempeg
synced 2024-11-22 00:51:37 +00:00
fftools/ffmpeg: prefer real errors over EOF in err_merge()
Fixes an issue in 6.1 when reading a corrupted file with -xerror would exit with success. This specific issue is not present in master, but this should generally be a more robust behaviour. Reported-by: Andrej Peterka Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
bc58488d89
commit
679b1e4657
@ -35,11 +35,12 @@ typedef struct Timestamp {
|
||||
/**
|
||||
* Merge two return codes - return one of the error codes if at least one of
|
||||
* them was negative, 0 otherwise.
|
||||
* Currently just picks the first one, eventually we might want to do something
|
||||
* more sophisticated, like sorting them by priority.
|
||||
*/
|
||||
static inline int err_merge(int err0, int err1)
|
||||
{
|
||||
// prefer "real" errors over EOF
|
||||
if ((err0 >= 0 || err0 == AVERROR_EOF) && err1 < 0)
|
||||
return err1;
|
||||
return (err0 < 0) ? err0 : FFMIN(err1, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user