[FFmpeg-cvslog] fftools/ffmpeg: consolidate exiting from main() on error

Anton Khirnov git at videolan.org
Thu Jul 20 21:57:36 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Jul 14 18:10:58 2023 +0200| [8173623e39cc72866eaaac13538e160f226b0a23] | committer: Anton Khirnov

fftools/ffmpeg: consolidate exiting from main() on error

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8173623e39cc72866eaaac13538e160f226b0a23
---

 fftools/ffmpeg.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index b4ea52ac1d..0c5e553c72 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1339,17 +1339,19 @@ int main(int argc, char **argv)
     /* parse options and open all input/output files */
     ret = ffmpeg_parse_options(argc, argv);
     if (ret < 0)
-        exit_program(1);
+        goto finish;
 
     if (nb_output_files <= 0 && nb_input_files == 0) {
         show_usage();
         av_log(NULL, AV_LOG_WARNING, "Use -h to get full help or, even better, run 'man %s'\n", program_name);
-        exit_program(1);
+        ret = 1;
+        goto finish;
     }
 
     if (nb_output_files <= 0) {
         av_log(NULL, AV_LOG_FATAL, "At least one output file must be specified\n");
-        exit_program(1);
+        ret = 1;
+        goto finish;
     }
 
     current_time = ti = get_benchmark_time_stamps();
@@ -1368,6 +1370,7 @@ int main(int argc, char **argv)
     ret = received_nb_signals ? 255 :
           err_rate_exceeded   ?  69 : ret;
 
+finish:
     exit_program(ret);
     return ret;
 }



More information about the ffmpeg-cvslog mailing list