summaryrefslogtreecommitdiff
path: root/channels/iax2/firmware.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-07-27 21:58:22 -0400
committerGeorge Joseph <gjoseph@digium.com>2017-08-01 15:42:38 -0600
commit58d032112b28294946427a379c40d51e5238999a (patch)
treed523247ac7e72502120025c6f7b56a99edd38d34 /channels/iax2/firmware.c
parent3f98488279dbc576c7569e8dd23e3120c07bbe7e (diff)
Fix compiler warnings on Fedora 26 / GCC 7.
GCC 7 has added capability to produce warnings, this fixes most of those warnings. The specific warnings are disabled in a few places: * app_voicemail.c: truncation of paths more than 4096 chars in many places. * chan_mgcp.c: callid truncated to 80 chars. * cdr.c: two userfields are combined to cdr copy, fix would break ABI. * tcptls.c: ignore use of deprecated method SSLv3_client_method(). ASTERISK-27156 #close Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88
Diffstat (limited to 'channels/iax2/firmware.c')
-rw-r--r--channels/iax2/firmware.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/channels/iax2/firmware.c b/channels/iax2/firmware.c
index 00a9d9ebb..500cf8938 100644
--- a/channels/iax2/firmware.c
+++ b/channels/iax2/firmware.c
@@ -44,6 +44,8 @@
#include "include/firmware.h"
+#define IAX_FIRMWARE_SUBDIR "/firmware/iax"
+
struct iax_firmware {
AST_LIST_ENTRY(iax_firmware) list;
int fd;
@@ -206,7 +208,7 @@ void iax_firmware_reload(void)
struct iax_firmware *cur = NULL;
DIR *fwd;
struct dirent *de;
- char dir[256], fn[256];
+ char fn[PATH_MAX + sizeof(IAX_FIRMWARE_SUBDIR) + sizeof(de->d_name)];
AST_LIST_LOCK(&firmwares);
@@ -216,12 +218,13 @@ void iax_firmware_reload(void)
}
/* Now that we have marked them dead... load new ones */
- snprintf(dir, sizeof(dir), "%s/firmware/iax", ast_config_AST_DATA_DIR);
- fwd = opendir(dir);
+ snprintf(fn, sizeof(fn), "%s%s", ast_config_AST_DATA_DIR, IAX_FIRMWARE_SUBDIR);
+ fwd = opendir(fn);
if (fwd) {
while((de = readdir(fwd))) {
if (de->d_name[0] != '.') {
- snprintf(fn, sizeof(fn), "%s/%s", dir, de->d_name);
+ snprintf(fn, sizeof(fn), "%s%s/%s",
+ ast_config_AST_DATA_DIR, IAX_FIRMWARE_SUBDIR, de->d_name);
if (!try_firmware(fn)) {
ast_verb(2, "Loaded firmware '%s'\n", de->d_name);
}
@@ -229,7 +232,7 @@ void iax_firmware_reload(void)
}
closedir(fwd);
} else {
- ast_log(LOG_WARNING, "Error opening firmware directory '%s': %s\n", dir, strerror(errno));
+ ast_log(LOG_WARNING, "Error opening firmware directory '%s': %s\n", fn, strerror(errno));
}
/* Clean up leftovers */