fix a bunch of potential problems found by gcc 4.3.x, primarily bare strings being passed to printf()-like functions and ignored results from read()/write() and friends

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@153337 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2008-11-01 18:22:39 +00:00
parent 705d6f3742
commit add5ff5b05
42 changed files with 2162 additions and 881 deletions

View File

@@ -482,7 +482,10 @@ static int spawn_mp3(struct mohclass *class)
}
}
/* Child */
chdir(class->dir);
if (chdir(class->dir) < 0) {
ast_log(LOG_WARNING, "chdir() failed: %s\n", strerror(errno));
_exit(1);
}
if (ast_test_flag(class, MOH_CUSTOM)) {
execv(argv[0], argv);
} else {
@@ -817,8 +820,14 @@ static int moh_scan_files(struct mohclass *class) {
class->total_files = 0;
dirnamelen = strlen(class->dir) + 2;
getcwd(path, sizeof(path));
chdir(class->dir);
if (!getcwd(path, sizeof(path))) {
ast_log(LOG_WARNING, "getcwd() failed: %s\n", strerror(errno));
return -1;
}
if (chdir(class->dir) < 0) {
ast_log(LOG_WARNING, "chdir() failed: %s\n", strerror(errno));
return -1;
}
while ((files_dirent = readdir(files_DIR))) {
/* The file name must be at least long enough to have the file type extension */
if ((strlen(files_dirent->d_name) < 4))
@@ -857,7 +866,10 @@ static int moh_scan_files(struct mohclass *class) {
}
closedir(files_DIR);
chdir(path);
if (chdir(path) < 0) {
ast_log(LOG_WARNING, "chdir() failed: %s\n", strerror(errno));
return -1;
}
return class->total_files;
}