[asterisk-commits] branch 1.2 r34875 - /branches/1.2/apps/app_voicemail.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jun 19 11:07:27 MST 2006


Author: tilghman
Date: Mon Jun 19 13:07:26 2006
New Revision: 34875

URL: http://svn.digium.com/view/asterisk?rev=34875&view=rev
Log:
Issue 7357 - txt file left behind when going to operator.  Also, fix a possible file descriptor leak.

Modified:
    branches/1.2/apps/app_voicemail.c

Modified: branches/1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_voicemail.c?rev=34875&r1=34874&r2=34875&view=diff
==============================================================================
--- branches/1.2/apps/app_voicemail.c (original)
+++ branches/1.2/apps/app_voicemail.c Mon Jun 19 13:07:26 2006
@@ -2601,6 +2601,7 @@
 			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 @@
 					/* 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 @@
 							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);



More information about the asterisk-commits mailing list