automerge commit

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@59354 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Automerge Script
2007-03-29 17:04:00 +00:00
parent 58500a4c7f
commit c23816ba19
14 changed files with 159 additions and 47 deletions

View File

@@ -94,7 +94,7 @@ static void retrieve_file(char *dir)
int res;
int fd=-1;
size_t fdlen = 0;
void *fdm=NULL;
void *fdm = MAP_FAILED;
SQLHSTMT stmt;
char sql[256];
char fmt[80]="";
@@ -161,7 +161,7 @@ static void retrieve_file(char *dir)
if (fd > -1)
fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
}
if (fdm) {
if (fdm != MAP_FAILED) {
memset(fdm, 0, fdlen);
res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, fdlen, &colsize);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
@@ -174,7 +174,7 @@ static void retrieve_file(char *dir)
} while (0);
} else
ast_log(LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
if (fdm)
if (fdm != MAP_FAILED)
munmap(fdm, fdlen);
if (fd > -1)
close(fd);

View File

@@ -61,6 +61,11 @@ static char *descrip =
"will be returned at the location of the Goto.\n"
"If ${MACRO_OFFSET} is set at termination, Macro will attempt to continue\n"
"at priority MACRO_OFFSET + N + 1 if such a step exists, and N + 1 otherwise.\n"
"Extensions: While a macro is being executed, it becomes the current context.\n"
" This means that if a hangup occurs, for instance, that the macro\n"
" will be searched for an 'h' extension, NOT the context from which\n"
" the macro was called. So, make sure to define all appropriate\n"
" extensions in your macro! (you can use 'catch' in AEL) \n"
"WARNING: Because of the way Macro is implemented (it executes the priorities\n"
" contained within it via sub-engine), and a fixed per-thread\n"
" memory stack allowance, macros are limited to 7 levels\n"

View File

@@ -836,7 +836,7 @@ static int retrieve_file(char *dir, int msgnum)
int res;
int fd=-1;
size_t fdlen = 0;
void *fdm=NULL;
void *fdm = MAP_FAILED;
SQLSMALLINT colcount=0;
SQLHSTMT stmt;
char sql[PATH_MAX];
@@ -944,7 +944,7 @@ static int retrieve_file(char *dir, int msgnum)
}
/* Read out in small chunks */
for (offset = 0; offset < colsize; offset += CHUNKSIZE) {
if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) {
if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == MAP_FAILED) {
ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
goto yuck;
@@ -1207,7 +1207,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
int x = 0;
int res;
int fd = -1;
void *fdm=NULL;
void *fdm = MAP_FAILED;
size_t fdlen = -1;
SQLHSTMT stmt;
SQLINTEGER len;
@@ -1262,7 +1262,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
lseek(fd, 0, SEEK_SET);
printf("Length is %d\n", fdlen);
fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED,fd, 0);
if (!fdm) {
if (fdm == MAP_FAILED) {
ast_log(LOG_WARNING, "Memory map failed!\n");
goto yuck;
}
@@ -1319,7 +1319,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
yuck:
if (cfg)
ast_config_destroy(cfg);
if (fdm)
if (fdm != MAP_FAILED)
munmap(fdm, fdlen);
if (fd > -1)
close(fd);