[Asterisk-cvs] asterisk/apps app_voicemail.c,1.55.2.3,1.55.2.4

markster at lists.digium.com markster at lists.digium.com
Fri Feb 27 19:44:23 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv16342/apps

Modified Files:
      Tag: v1-0_stable
	app_voicemail.c 
Log Message:
Don't write duration if file disappears (bug #1102 -- thanks hmodes)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.55.2.3
retrieving revision 1.55.2.4
diff -u -d -r1.55.2.3 -r1.55.2.4
--- app_voicemail.c	25 Feb 2004 21:58:35 -0000	1.55.2.3
+++ app_voicemail.c	28 Feb 2004 00:33:52 -0000	1.55.2.4
@@ -1338,6 +1338,7 @@
 	FILE *txt;
 	int res = 0;
 	int msgnum;
+	int fd;
 	char date[256];
 	char dir[256];
 	char fn[256];
@@ -1473,11 +1474,15 @@
 				res = play_and_record(chan, NULL, fn, vmmaxmessage, fmt);
 				if (res > 0)
 					res = 0;
-				txt = fopen(txtfile, "a");
-				if (txt) {
-					time(&end);
-					fprintf(txt, "duration=%ld\n", (long)(end-start));
-					fclose(txt);
+				fd = open(txtfile, O_APPEND | O_WRONLY);
+				if (fd > -1) {
+					txt = fdopen(fd, "a");
+					if (txt) {
+						time(&end);
+						fprintf(txt, "duration=%ld\n", (long)(end-start));
+						fclose(txt);
+					} else
+						close(fd);
 				}
 				stringp = fmt;
 				strsep(&stringp, "|");




More information about the svn-commits mailing list