shithub: sox

Download patch

ref: a882fd226ffdba93f2cb9c8ad0c4623e62375629
parent: 51a2afcd3cf74ee007dc3b5210c2d9447ced7a74
author: cbagwell <cbagwell>
date: Thu Sep 6 16:49:36 EDT 2007

Let application cleanup on init errors.

--- a/src/sox.c
+++ b/src/sox.c
@@ -614,7 +614,8 @@
   else if (strends(myname, "rec"))
     rec = sox_true;
 
-  sox_format_init();
+  if (sox_format_init() != SOX_SUCCESS)
+      exit(1);
  
   parse_options_and_filenames(argc, argv);
 
--- a/src/soxio.c
+++ b/src/soxio.c
@@ -59,12 +59,13 @@
 
   if ((ret = lt_dlinit()) != 0) {
     sox_fail("lt_dlinit failed with %d error(s): %s", ret, lt_dlerror());
-    exit(1);
+    return SOX_EOF;
   }
   plugins_initted = sox_true;
 
   lt_dlforeachfile(PKGLIBDIR, init_format, NULL);
 #endif
+  return SOX_SUCCESS;
 }
 
 /*
@@ -93,7 +94,6 @@
     int ret;
     if (plugins_initted && (ret = lt_dlexit()) != 0) {
       sox_fail("lt_dlexit failed with %d error(s): %s", ret, lt_dlerror());
-      exit(1);
     }
   }
 #endif