Git development
 help / color / mirror / Atom feed
* [PATCH] close clobbers mmap's errno in read_cache
@ 2005-10-07 21:45 Alex Riesen
  2005-10-07 21:48 ` Sven Verdoolaege
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Riesen @ 2005-10-07 21:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Save errno before close(fd) for strerror in die().

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>

--- a/read-cache.c	2005-10-03 09:16:31.000000000 +0200
+++ b/read-cache.c	2005-10-07 23:23:40.000000000 +0200
@@ -482,9 +482,10 @@ int read_cache(void)
 		if (size >= sizeof(struct cache_header) + 20)
 			map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
 	}
+	i = errno;
 	close(fd);
 	if (map == MAP_FAILED)
-		die("index file mmap failed (%s)", strerror(errno));
+		die("index file mmap failed (%s)", strerror(i));
 
 	hdr = map;
 	if (verify_hdr(hdr, size) < 0)

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

end of thread, other threads:[~2005-10-07 23:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-07 21:45 [PATCH] close clobbers mmap's errno in read_cache Alex Riesen
2005-10-07 21:48 ` Sven Verdoolaege
2005-10-07 23:50   ` Alex Riesen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox