From 8c85a8461c14ee676e35e390b564df77252f0cf2 Mon Sep 17 00:00:00 2001
From: Mark Spencer <markster@digium.com>
Date: Mon, 10 Jan 2005 05:29:46 +0000
Subject: [PATCH] Truncate file as appropriate (bug #3304)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_voicemail.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 7ca0132e6f..5d8e8f9c98 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -772,6 +772,8 @@ static int retrieve_file(char *dir, int msgnum)
 							SQLFreeHandle (SQL_HANDLE_STMT, stmt);
 							goto yuck;
 						}
+						fdlen = colsize;
+						ftruncate(fd, fdlen);
 					}
 				} else {
 					res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), NULL);
@@ -780,7 +782,6 @@ static int retrieve_file(char *dir, int msgnum)
 						SQLFreeHandle (SQL_HANDLE_STMT, stmt);
 						goto yuck;
 					}
-					printf("Got field '%s'\n", coltitle);
 					if (strcmp(coltitle, "msgnum") && strcmp(coltitle, "dir") && f)
 						fprintf(f, "%s=%s\n", coltitle, rowdata);
 				}
-- 
GitLab