summaryrefslogtreecommitdiff
path: root/Src/Modules/mapfile.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2009-03-15 01:04:50 +0000
committerWayne Davison <wayned@users.sourceforge.net>2009-03-15 01:04:50 +0000
commitbf25c3a43f79f568b55c45e2701f5c961977b47c (patch)
treeeacd272cd739c11b793aa5788bba21fdc6d1205e /Src/Modules/mapfile.c
parentf0bcd0ecd0896180c5a3f977e086f7237a774d25 (diff)
downloadzsh-bf25c3a43f79f568b55c45e2701f5c961977b47c.tar.gz
zsh-bf25c3a43f79f568b55c45e2701f5c961977b47c.zip
26735: Check some function return values for failures. Gets rid of
some compiler warnings, and improves error handling/notification.
Diffstat (limited to 'Src/Modules/mapfile.c')
-rw-r--r--Src/Modules/mapfile.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/Modules/mapfile.c b/Src/Modules/mapfile.c
index d825c7faa..422c7077c 100644
--- a/Src/Modules/mapfile.c
+++ b/Src/Modules/mapfile.c
@@ -92,7 +92,8 @@ setpmmapfile(Param pm, char *value)
* First we need to make sure the file is long enough for
* when we msync. On AIX, at least, we just get zeroes otherwise.
*/
- ftruncate(fd, len);
+ if (ftruncate(fd, len) < 0)
+ zwarn("ftruncate failed: %e", errno);
memcpy(mmptr, value, len);
#ifndef MS_SYNC
#define MS_SYNC 0
@@ -102,7 +103,8 @@ setpmmapfile(Param pm, char *value)
* Then we need to truncate again, since mmap() always maps complete
* pages. Honestly, I tried it without, and you need both.
*/
- ftruncate(fd, len);
+ if (ftruncate(fd, len) < 0)
+ zwarn("ftruncate failed: %e", errno);
munmap(mmptr, len);
}
#else /* don't USE_MMAP */