From: Andrew Tridgell Date: Wed, 6 May 1998 07:28:14 +0000 (+0000) Subject: handle mmap() failures X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/94c9ef1fc351c4b7884b87d9ae80bc13272441ac handle mmap() failures --- 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; }