diff options
author | automerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-22 17:22:37 +0000 |
---|---|---|
committer | automerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-22 17:22:37 +0000 |
commit | cfc369cefa6309a56a2eb9f42ab1d72910b2aa95 (patch) | |
tree | 4753867bb95e326a09f1f7af1720bb4040854acd /apps | |
parent | 9e4e3861f451d004c7a4cc881375d2ad304f6ab6 (diff) |
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@51403 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 4c49a2488..47896a0d6 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -932,7 +932,7 @@ static int retrieve_file(char *dir, int msgnum) } if (!strcasecmp(coltitle, "recording")) { off_t offset; - res = SQLGetData(stmt, x + 1, SQL_BINARY, NULL, 0, &colsize); + res = SQLGetData(stmt, x + 1, SQL_BINARY, rowdata, 0, &colsize); fdlen = colsize; if (fd > -1) { char tmp[1]=""; @@ -944,14 +944,13 @@ static int retrieve_file(char *dir, int msgnum) } /* Read out in small chunks */ for (offset = 0; offset < colsize; offset += CHUNKSIZE) { - /* +1 because SQLGetData likes null-terminating binary data */ - if ((fdm = mmap(NULL, CHUNKSIZE + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == -1) { + if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) { ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno); SQLFreeHandle(SQL_HANDLE_STMT, stmt); goto yuck; } else { - res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, CHUNKSIZE + 1, NULL); - munmap(fdm, 0); + res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, CHUNKSIZE, NULL); + munmap(fdm, CHUNKSIZE); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql); unlink(full_fn); |