mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
various files - fix some alerts raised by lgtm code analysis
This patch fixes several issues reported by the lgtm code analysis tool: https://lgtm.com/projects/g/asterisk/asterisk Not all reported issues were addressed in this patch. This patch mostly fixes confirmed reported errors, potential problematic code points, and a few other "low hanging" warnings or recommendations found in core supported modules. These include, but are not limited to the following: * innapropriate stack allocation in loops * buffer overflows * variable declaration "hiding" another variable declaration * comparisons results that are always the same * ambiguously signed bit-field members * missing header guards Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
This commit is contained in:
committed by
George Joseph
parent
e7320bbbf0
commit
30c0af7257
@@ -3488,10 +3488,11 @@ static void main_atexit(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
char * xarg = NULL;
|
||||
int x;
|
||||
int isroot = 1, rundir_exists = 0;
|
||||
const char *runuser = NULL, *rungroup = NULL;
|
||||
RAII_VAR(char *, runuser, NULL, ast_free);
|
||||
RAII_VAR(char *, rungroup, NULL, ast_free);
|
||||
RAII_VAR(char *, xarg, NULL, ast_free);
|
||||
struct rlimit l;
|
||||
static const char *getopt_settings = "BC:cde:FfG:ghIiL:M:mnpqRrs:TtU:VvWXx:";
|
||||
|
||||
@@ -3596,7 +3597,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
#endif
|
||||
case 'G':
|
||||
rungroup = ast_strdupa(optarg);
|
||||
rungroup = ast_strdup(optarg);
|
||||
break;
|
||||
case 'g':
|
||||
ast_set_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE);
|
||||
@@ -3652,7 +3653,7 @@ int main(int argc, char *argv[])
|
||||
ast_set_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES);
|
||||
break;
|
||||
case 'U':
|
||||
runuser = ast_strdupa(optarg);
|
||||
runuser = ast_strdup(optarg);
|
||||
break;
|
||||
case 'V':
|
||||
case 'v':
|
||||
@@ -3667,7 +3668,7 @@ int main(int argc, char *argv[])
|
||||
ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
|
||||
|
||||
ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC | AST_OPT_FLAG_NO_COLOR);
|
||||
xarg = ast_strdupa(optarg);
|
||||
xarg = ast_strdup(optarg);
|
||||
break;
|
||||
case '?':
|
||||
/* already processed. */
|
||||
@@ -3746,9 +3747,9 @@ int main(int argc, char *argv[])
|
||||
#endif /* !defined(CONFIGURE_RAN_AS_ROOT) */
|
||||
|
||||
if ((!rungroup) && !ast_strlen_zero(ast_config_AST_RUN_GROUP))
|
||||
rungroup = ast_config_AST_RUN_GROUP;
|
||||
rungroup = ast_strdup(ast_config_AST_RUN_GROUP);
|
||||
if ((!runuser) && !ast_strlen_zero(ast_config_AST_RUN_USER))
|
||||
runuser = ast_config_AST_RUN_USER;
|
||||
runuser = ast_strdup(ast_config_AST_RUN_USER);
|
||||
|
||||
/* Must install this signal handler up here to ensure that if the canary
|
||||
* fails to execute that it doesn't kill the Asterisk process.
|
||||
|
Reference in New Issue
Block a user