diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-18 10:24:58 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-18 10:24:58 +0000 |
commit | 553ab5f770df03d4936de89ad33faa757a5a7151 (patch) | |
tree | 48fcbf7932507d398d956c38dbcff47370d07b05 /utils | |
parent | 659205253cbd99d28a324c50ae111dad77b7370c (diff) |
make configuration variable const so they are not accidentally
modified.
This requires casting the strings in asterisk.c when writing to
them, so we do it through a macro to do it consistently.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@93603 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils')
-rw-r--r-- | utils/ael_main.c | 10 | ||||
-rw-r--r-- | utils/conf2ael.c | 6 | ||||
-rw-r--r-- | utils/extconf.c | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/utils/ael_main.c b/utils/ael_main.c index 830b83807..68b5dc479 100644 --- a/utils/ael_main.c +++ b/utils/ael_main.c @@ -82,8 +82,8 @@ struct namelist *globalvars_last; int conts=0, extens=0, priors=0; char last_exten[18000]; -char ast_config_AST_CONFIG_DIR[PATH_MAX]; -char ast_config_AST_VAR_DIR[PATH_MAX]; +const char ast_config_AST_CONFIG_DIR[PATH_MAX]; +const char ast_config_AST_VAR_DIR[PATH_MAX]; void ast_cli_register_multiple(void); int ast_add_extension2(struct ast_context *con, @@ -514,14 +514,14 @@ int main(int argc, char **argv) } if( use_curr_dir ) { - strcpy(ast_config_AST_CONFIG_DIR, "."); + strcpy((char *)ast_config_AST_CONFIG_DIR, "."); localized_use_local_dir(); } else { - strcpy(ast_config_AST_CONFIG_DIR, "/etc/asterisk"); + strcpy((char *)ast_config_AST_CONFIG_DIR, "/etc/asterisk"); localized_use_conf_dir(); } - strcpy(ast_config_AST_VAR_DIR, "/var/lib/asterisk"); + strcpy((char *)ast_config_AST_VAR_DIR, "/var/lib/asterisk"); if( dump_extensions ) { dumpfile = fopen("extensions.conf.aeldump","w"); diff --git a/utils/conf2ael.c b/utils/conf2ael.c index 4983b5bf2..b8cae75ec 100644 --- a/utils/conf2ael.c +++ b/utils/conf2ael.c @@ -63,7 +63,7 @@ void get_start_stop(unsigned int *word, int bitsperword, int totalbits, int *sta int all_bits_set(unsigned int *word, int bitsperword, int totalbits); extern char *days[]; extern char *months[]; -char ast_config_AST_CONFIG_DIR[PATH_MAX]; +const char ast_config_AST_CONFIG_DIR[PATH_MAX]; char *config = "extensions.conf"; @@ -79,7 +79,7 @@ char ast_config_AST_SYSTEM_NAME[20] = ""; */ /*! Go no deeper than this through includes (not counting loops) */ #define AST_PBX_MAX_STACK 128 /* static AST_RWLIST_HEAD_STATIC(acf_root, ast_custom_function); */ -extern char ast_config_AST_CONFIG_DIR[PATH_MAX]; +//extern char ast_config_AST_CONFIG_DIR[PATH_MAX]; void ast_register_file_version(const char *file, const char *version) { @@ -363,7 +363,7 @@ int main(int argc, char **argv) if (!localdir) printf(" (You could use -d the use the extensions.conf in the current directory!)\n"); - strcpy(ast_config_AST_CONFIG_DIR,"/etc/asterisk"); + strcpy((char *)ast_config_AST_CONFIG_DIR,"/etc/asterisk"); printf("Loading %s/%s...\n", ast_config_AST_CONFIG_DIR, config); diff --git a/utils/extconf.c b/utils/extconf.c index c6e8cf610..4621e345b 100644 --- a/utils/extconf.c +++ b/utils/extconf.c @@ -53,7 +53,7 @@ # include <glob.h> #endif -static char ast_config_AST_CONFIG_DIR[PATH_MAX] = {"/etc/asterisk"}; +static const char ast_config_AST_CONFIG_DIR[PATH_MAX] = {"/etc/asterisk"}; #define AST_API_MODULE 1 /* gimme the inline defs! */ struct ast_channel { |