shithub: sox

Download patch

ref: 4dd0666438f6dc7fc0cd2d4f77b39e4155892cff
parent: 176a83866abcbdf31d52a1ed1ad64fb145628bb7
author: Mans Rullgard <mans@mansr.com>
date: Wed Aug 5 12:03:50 EDT 2020

sox: exit with non-zero status on error [bug #212]

--- a/src/sox.c
+++ b/src/sox.c
@@ -2905,6 +2905,7 @@
 {
   size_t i;
   char mybase[6];
+  int err;
 
   gettimeofday(&load_timeofday, NULL);
   myname = argv[0];
@@ -3058,8 +3059,12 @@
     read_user_effects(effects_filename);
   }
 
-  while (process() != SOX_EOF && !user_abort && current_input < input_count)
-  {
+  for (;;) {
+    err = process();
+
+    if (err == SOX_EOF || user_abort || current_input >= input_count)
+      break;
+
     if (advance_eff_chain() == SOX_EOF)
       break;
 
@@ -3102,5 +3107,5 @@
 
   cleanup();
 
-  return 0;
+  return !!err;
 }