summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-10-31 15:52:32 +0000
committerMatthew Jordan <mjordan@digium.com>2013-10-31 15:52:32 +0000
commit981983bfdef664e5b275ff097173198784218f78 (patch)
treef1200a04c92eacfe8116ad394a727ae6491a533b
parent069da1e75afc22db5c004ebb9b67f83d2a72e8d7 (diff)
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402286 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--main/media_index.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/main/media_index.c b/main/media_index.c
index 64fbbbddb..278b37c26 100644
--- a/main/media_index.c
+++ b/main/media_index.c
@@ -394,7 +394,7 @@ static int process_description_file(struct ast_media_index *index,
}
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 @@ static int process_description_file(struct ast_media_index *index,
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 @@ static int process_description_file(struct ast_media_index *index,
}
}
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 @@ static int media_index_update(struct ast_media_index *index,
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 @@ static int media_index_update(struct ast_media_index *index,
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;
}