Commit 57363308f3065159bcdea6be975c758e992781da

Stefan Sperling 2018-07-09T16:20:48

fall back to read() as intended if mapping packfile fails

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/lib/pack.c b/lib/pack.c
index 2c8c7be..c285d19 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -586,10 +586,8 @@ cache_pack(struct got_pack **packp, const char *path_packfile,
 
 	pack->map = mmap(NULL, pack->filesize, PROT_READ, MAP_PRIVATE,
 	    pack->fd, 0);
-	if (pack->map == MAP_FAILED) {
-		err = got_error_from_errno();
-		pack->map = NULL;
-	}
+	if (pack->map == MAP_FAILED)
+		pack->map = NULL; /* fall back to read(2) */
 done:
 	if (err) {
 		if (pack) {