[Asterisk-cvs] asterisk/apps app_voicemail.c,1.58,1.59
markster at lists.digium.com
markster at lists.digium.com
Fri Feb 27 19:43:54 CST 2004
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv16296/apps
Modified Files:
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.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- app_voicemail.c 25 Feb 2004 21:43:32 -0000 1.58
+++ app_voicemail.c 28 Feb 2004 00:33:15 -0000 1.59
@@ -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