[asterisk-commits] mjordan: trunk r402286 - in /trunk: ./ main/media_index.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 31 10:52:34 CDT 2013


Author: mjordan
Date: Thu Oct 31 10:52:32 2013
New Revision: 402286

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402286
Log:
medix_index: Display errors when library calls fail

Based on feedback from ipengineer in #asterisk, when the media indexer
cannot access a sound file on the system (or otherwise fails) Asterisk
displays a "Cannot frob file" error but fails to tell you why. This is
especially problematic as the media_indexer failing will rpevent Asterisk
from starting, as it is in the core.

We now display the errno error messages so folks can figure out what they've
done wrong.
........

Merged revisions 402285 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/media_index.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Thu Oct 31 10:52:32 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402276
+/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402276,402285

Modified: trunk/main/media_index.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/media_index.c?view=diff&rev=402286&r1=402285&r2=402286
==============================================================================
--- trunk/main/media_index.c (original)
+++ trunk/main/media_index.c Thu Oct 31 10:52:32 2013
@@ -394,7 +394,7 @@
 	}
 	f = fopen(ast_str_buffer(description_file_path), "r");
 	if (!f) {
-		ast_log(LOG_WARNING, "Could not open media description file '%s'\n", ast_str_buffer(description_file_path));
+		ast_log(LOG_WARNING, "Could not open media description file '%s': %s\n", ast_str_buffer(description_file_path), strerror(errno));
 		return -1;
 	}
 
@@ -402,7 +402,7 @@
 		char *file_identifier, *description;
 		if (!fgets(buf, sizeof(buf), f)) {
 			if (ferror(f)) {
-				ast_log(LOG_ERROR, "Error reading from file %s\n", ast_str_buffer(description_file_path));
+				ast_log(LOG_ERROR, "Error reading from file %s: %s\n", ast_str_buffer(description_file_path), strerror(errno));
 			}
 			continue;
 		}
@@ -416,7 +416,7 @@
 				}
 			}
 			if (ferror(f)) {
-				ast_log(LOG_ERROR, "Error reading from file %s\n", ast_str_buffer(description_file_path));
+				ast_log(LOG_ERROR, "Error reading from file %s: %s\n", ast_str_buffer(description_file_path), strerror(errno));
 			}
 			continue;
 		}
@@ -536,7 +536,7 @@
 
 	srcdir = opendir(ast_str_buffer(index_dir));
 	if (srcdir == NULL) {
-		ast_log(LOG_ERROR, "Failed to open %s\n", ast_str_buffer(index_dir));
+		ast_log(LOG_ERROR, "Failed to open %s: %s\n", ast_str_buffer(index_dir), strerror(errno));
 		return -1;
 	}
 
@@ -551,7 +551,7 @@
 		ast_str_set(&statfile, 0, "%s/%s", ast_str_buffer(index_dir), dent->d_name);
 
 		if (stat(ast_str_buffer(statfile), &st) < 0) {
-			ast_log(LOG_ERROR, "Failed to stat %s\n", ast_str_buffer(statfile));
+			ast_log(LOG_ERROR, "Failed to stat %s: %s\n", ast_str_buffer(statfile), strerror(errno));
 			res = -1;
 			break;
 		}




More information about the asterisk-commits mailing list