aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_directory.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-27 23:20:22 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-27 23:20:22 +0000
commit274f0d20d5c0dda07d1ccc04fe32df5147a28414 (patch)
tree6562b96cf8e6405cc26f8be1c812780a91151d82 /apps/app_directory.c
parent47e3ad32faface1c2047d73b0fdd60b6d2e2030b (diff)
Merged revisions 59277 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r59277 | russell | 2007-03-27 18:19:41 -0500 (Tue, 27 Mar 2007) | 3 lines Fix the check of the return value from mmap(). Thanks to Corydon for catching this one. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@59278 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_directory.c')
-rw-r--r--apps/app_directory.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index ea5206533..a179a8273 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -95,7 +95,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]="";
@@ -162,7 +162,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)) {
@@ -176,7 +176,7 @@ static void retrieve_file(char *dir)
ast_odbc_release_obj(obj);
} 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);