summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-05-06 07:28:14 +0000
committerAndrew Tridgell <tridge@samba.org>1998-05-06 07:28:14 +0000
commit94c9ef1fc351c4b7884b87d9ae80bc13272441ac (patch)
tree6429e716e49ed38bbde80e5937fc9273a8035e71 /util.c
parent59503278bfc27ad27c03dfaeab4e3de02198f81c (diff)
downloadrsync-94c9ef1fc351c4b7884b87d9ae80bc13272441ac.tar.gz
handle mmap() failures
Diffstat (limited to 'util.c')
-rw-r--r--util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/util.c b/util.c
index f1665e3e..357b8308 100644
--- a/util.c
+++ b/util.c
@@ -47,8 +47,12 @@ struct map_struct *map_file(int fd,OFF_T len)
ret->p_len = 0;
#ifdef HAVE_MMAP
- if (len < MAX_MAP_SIZE)
- ret->map = (char *)mmap(NULL,len,PROT_READ,MAP_SHARED,fd,0);
+ if (len < MAX_MAP_SIZE) {
+ ret->map = (char *)mmap(NULL,len,PROT_READ,MAP_SHARED,fd,0);
+ if (ret->map == (char *)-1) {
+ ret->map = NULL;
+ }
+ }
#endif
return ret;
}