mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 03:48:02 +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:
@@ -2918,7 +2918,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];
|
||||
int object, do_exec, do_include;
|
||||
|
||||
/* Actually parse the entry */
|
||||
@@ -3032,8 +3032,14 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
||||
/* #exec </path/to/executable>
|
||||
We create a tmp file, then we #include it, then we delete it. */
|
||||
if (do_exec) {
|
||||
char cmd[1024];
|
||||
|
||||
snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d.%ld", (int)time(NULL), (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