summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2003-09-25 13:18:03 +0000
committerMark Spencer <markster@digium.com>2003-09-25 13:18:03 +0000
commit273e1b07d6a7be2a60bbffd542c2647f718d129d (patch)
tree842c7b30b46a0f21e1356de8fde227c4ec798b93 /apps
parent403f27e5b94368b94ec8892390d444f9dd4c208a (diff)
Keep voicemail from segging on a permissions problem (bug #245)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_voicemail2.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/app_voicemail2.c b/apps/app_voicemail2.c
index 6ff1a016d..a2fbca42f 100755
--- a/apps/app_voicemail2.c
+++ b/apps/app_voicemail2.c
@@ -375,10 +375,24 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
char tmpin[AST_CONFIG_MAX_PATH];
char tmpout[AST_CONFIG_MAX_PATH];
char *user, *pass, *rest, *trim;
- snprintf((char *)tmpin, sizeof(tmpin)-1, "%s/voicemail.conf",(char *)ast_config_AST_CONFIG_DIR);
- snprintf((char *)tmpout, sizeof(tmpout)-1, "%s/voicemail.conf.new",(char *)ast_config_AST_CONFIG_DIR);
+ snprintf((char *)tmpin, sizeof(tmpin)-1, "%s/voicemail.conf",(char *)ast_config_AST_CONFIG_DIR);
+ snprintf((char *)tmpout, sizeof(tmpout)-1, "%s/voicemail.conf.new",(char *)ast_config_AST_CONFIG_DIR);
configin = fopen((char *)tmpin,"r");
- configout = fopen((char *)tmpout,"w+");
+ if (configin)
+ configout = fopen((char *)tmpout,"w+");
+ else
+ configout = NULL;
+ if(!configin || !configout) {
+ if (configin)
+ fclose(configin);
+ else
+ ast_log(LOG_WARNING, "Warning: Unable to open '%s' for reading: %s\n", tmpin, strerror(errno));
+ if (configout)
+ fclose(configout);
+ else
+ ast_log(LOG_WARNING, "Warning: Unable to open '%s' for writing: %s\n", tmpout, strerror(errno));
+ return;
+ }
while (!feof(configin)) {
/* Read in the line */
@@ -1955,7 +1969,7 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v
/* Can't think of how other diffs might be helpful, but I'm sure somebody will think of something. */
#endif
if (the_zone)
- res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, &(the_zone->timezone));
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone);
else
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL);
#if 0