]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge script <automerge@asterisk.org>
Tue, 21 Mar 2006 07:06:15 +0000 (07:06 +0000)
committerAutomerge script <automerge@asterisk.org>
Tue, 21 Mar 2006 07:06:15 +0000 (07:06 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@13784 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index 43eb4fb66b2a8c402b12b4f1ef29c4f140ea80aa..4c0229e3e8160a192e2d58de777cc39fae8c56bf 100644 (file)
@@ -2367,7 +2367,7 @@ struct leave_vm_options {
 
 static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_options *options)
 {
-       char txtfile[256];
+       char tmptxtfile[256], txtfile[256];
        char callerid[256];
        FILE *txt;
        int res = 0;
@@ -2564,7 +2564,8 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                                
                        /* Store information */
                        snprintf(txtfile, sizeof(txtfile), "%s.txt", fn);
-                       txt = fopen(txtfile, "w+");
+                       snprintf(tmptxtfile, sizeof(tmptxtfile), "%s.txt.tmp", fn);
+                       txt = fopen(tmptxtfile, "w+");
                        if (txt) {
                                get_date(date, sizeof(date));
                                fprintf(txt, 
@@ -2604,6 +2605,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                        if (txt) {
                                fprintf(txt, "duration=%d\n", duration);
                                fclose(txt);
+                               rename(tmptxtfile, txtfile);
                        }
                                
                        if (duration < vmminmessage) {