From 7352220be0a924426d375d1f29346bf7bc7dc6ae Mon Sep 17 00:00:00 2001 From: automerge Date: Thu, 29 Mar 2007 17:04:00 +0000 Subject: automerge commit git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@59354 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_directory.c | 6 +++--- apps/app_macro.c | 5 +++++ apps/app_voicemail.c | 10 +++++----- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'apps') diff --git a/apps/app_directory.c b/apps/app_directory.c index 9caefc030..2b1d4e967 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -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); diff --git a/apps/app_macro.c b/apps/app_macro.c index 425836278..45e7d70ab 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -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" diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 23cf6bd4b..bd6e8b8d6 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -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); -- cgit v1.2.3