mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-18 07:48:14 +00:00
Fix GCC 8 build issues.
This fixes build warnings found by GCC 8. In some cases format truncation is intentional so the warning is just suppressed. ASTERISK-27824 #close Change-Id: I724f146cbddba8b86619d4c4a9931ee877995c84
This commit is contained in:
@@ -1738,7 +1738,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
||||
char *c;
|
||||
char *cur = buf;
|
||||
struct ast_variable *v;
|
||||
char cmd[512], exec_file[512];
|
||||
char exec_file[512];
|
||||
|
||||
/* Actually parse the entry */
|
||||
if (cur[0] == '[') { /* A category header */
|
||||
@@ -1911,10 +1911,16 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
||||
We create a tmp file, then we #include it, then we delete it. */
|
||||
if (!do_include) {
|
||||
struct timeval now = ast_tvnow();
|
||||
char cmd[1024];
|
||||
|
||||
if (!ast_test_flag(&flags, CONFIG_FLAG_NOCACHE))
|
||||
config_cache_attribute(configfile, ATTRIBUTE_EXEC, NULL, who_asked);
|
||||
snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d%d.%ld", (int)now.tv_sec, (int)now.tv_usec, (long)pthread_self());
|
||||
snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);
|
||||
if (snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file) >= sizeof(cmd)) {
|
||||
ast_log(LOG_ERROR, "Failed to construct command string to execute %s.\n", cur);
|
||||
|
||||
return -1;
|
||||
}
|
||||
ast_safe_system(cmd);
|
||||
cur = exec_file;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user