git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] compat: make sure git_mmap is not expected to write
@ 2018-10-23  5:12 carlo
  2018-10-23 10:13 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: carlo @ 2018-10-23  5:12 UTC (permalink / raw)
  To: git; +Cc: Johannes.Schindelin, carlo

in f48000fc ("Yank writing-back support from gitfakemmap.", 2005-10-08)
support for writting back changes was removed but the specific prot
flag that would be used was not checked for)

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 compat/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/mmap.c b/compat/mmap.c
index 7f662fef7b..14d31010df 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
 {
 	size_t n = 0;
 
-	if (start != NULL || !(flags & MAP_PRIVATE))
+	if (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)
 		die("Invalid usage of mmap when built with NO_MMAP");
 
 	start = xmalloc(length);
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-24  3:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23  5:12 [PATCH] compat: make sure git_mmap is not expected to write carlo
2018-10-23 10:13 ` Johannes Schindelin
2018-10-23 12:35   ` [PATCH v2] " Carlo Marcelo Arenas Belón
2018-10-24  1:43     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).