diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-06-19 18:07:26 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-06-19 18:07:26 +0000 |
commit | e303de5b1fa7fc017143fa6adb6fdec856d484c7 (patch) | |
tree | b74fc7ac3c700a4a31d4e615511018c2740827dc | |
parent | d2396dc21264d569f0d7c9f51785088b50859e5b (diff) |
Issue 7357 - txt file left behind when going to operator. Also, fix a possible file descriptor leak.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@34875 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | apps/app_voicemail.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 42ccef3c6..32e9f849e 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -2601,6 +2601,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ if (duration < vmminmessage) { if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminmessage); + fclose(txt); ast_filedelete(tmptxtfile, NULL); unlink(tmptxtfile); } else { @@ -2611,6 +2612,10 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ /* Delete files */ ast_filedelete(tmptxtfile, NULL); unlink(tmptxtfile); + } else if (ast_fileexists(tmptxtfile, NULL, NULL) <= 0) { + if (option_debug) + ast_log(LOG_DEBUG, "The recorded media file is gone, so we should remove the .txt file too!\n"); + unlink(tmptxtfile); } else { for (;;) { make_file(fn, sizeof(fn), dir, msgnum); @@ -2644,7 +2649,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ free_user(recip); } } - if (ast_fileexists(fn, NULL, NULL)) { + if (ast_fileexists(fn, NULL, NULL) > 0) { STORE(dir, vmu->mailbox, vmu->context, msgnum); notify_new_message(chan, vmu, msgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name); DISPOSE(dir, msgnum); |