Exit codes are usually uint8_t with the upper half of the value
sometimes indicating signals. AVERROR codes are larger, it is
possible that an AVERROR code maps to 0.

Leaving 255 as is, as it represents signals.

Signed-off-by: Nicolas George <[email protected]>
---
 fftools/ffmpeg.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)


Updated version because I had missed another chunk of Anton's misuse of
C API.

Will push very soon.


diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index d38acffbdf..f3c33e8901 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1050,9 +1050,6 @@ int main(int argc, char **argv)
                utime / 1000000.0, stime / 1000000.0, rtime / 1000000.0);
     }
 
-    ret = received_nb_signals                 ? 255 :
-          (ret == FFMPEG_ERROR_RATE_EXCEEDED) ?  69 : ret;
-
 finish:
     if (ret == AVERROR_EXIT)
         ret = 0;
@@ -1062,7 +1059,9 @@ finish:
     sch_free(&sch);
 
     av_log(NULL, AV_LOG_VERBOSE, "\n");
-    av_log(NULL, AV_LOG_VERBOSE, "Exiting with exit code %d\n", ret);
+    av_log(NULL, AV_LOG_VERBOSE, "Exiting with status %d\n", ret);
 
-    return ret;
+    return received_nb_signals ? 255 :
+           ret == FFMPEG_ERROR_RATE_EXCEEDED ? 69 :
+           ret < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }
-- 
2.53.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to