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:44:29 -0600
commit0f49e6ee2e270ef2e6df18c990fcf24f679eba44 (patch)
treee4649fa8837b425ae5a39464f36fc30cbcd431c4 /channels/iax2/firmware.c
parent0d58fefa303f267eb8fa00d4aa1bcff12956111e (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 a1ee43550..0286132dd 100644
--- a/channels/iax2/firmware.c
+++ b/channels/iax2/firmware.c
@@ -46,6 +46,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "include/firmware.h"
+#define IAX_FIRMWARE_SUBDIR "/firmware/iax"
+
struct iax_firmware {
AST_LIST_ENTRY(iax_firmware) list;
int fd;
@@ -208,7 +210,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);
@@ -218,12 +220,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);
}
@@ -231,7 +234,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 */