summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-11-09 00:04:15 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-11-09 00:04:15 +0000
commitdb176529529c142333f668f2c1334753f7f406bf (patch)
treed9e55d415552e5929ab915f009212328fd3f4063 /common
parent118f08c948b7e90066f5340c87bd3f356f696c51 (diff)
Include checks for mmap() returning NULL
Diffstat (limited to 'common')
-rw-r--r--common/textfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/textfile.c b/common/textfile.c
index dd77980c..b2134562 100644
--- a/common/textfile.c
+++ b/common/textfile.c
@@ -149,7 +149,7 @@ int textfile_put(char *pathname, char *key, char *value)
}
map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_LOCKED, fd, 0);
- if (map == MAP_FAILED) {
+ if (!map || map == MAP_FAILED) {
err = errno;
goto unlock;
}
@@ -243,7 +243,7 @@ char *textfile_get(char *pathname, char *key)
size = st.st_size;
map = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
- if (map == MAP_FAILED) {
+ if (!map || map == MAP_FAILED) {
err = errno;
goto unlock;
}