mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-15 00:41:02 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user