* [PATCH] sha1_file: remove an used fd variable
@ 2017-04-16 19:04 Sebastian Schuberth
2017-04-17 1:41 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Schuberth @ 2017-04-16 19:04 UTC (permalink / raw
To: git
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
sha1_file.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 7106389..9ecf71f 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -3970,7 +3970,6 @@ int read_loose_object(const char *path,
void **contents)
{
int ret = -1;
- int fd = -1;
void *map = NULL;
unsigned long mapsize;
git_zstream stream;
@@ -4020,7 +4019,5 @@ int read_loose_object(const char *path,
out:
if (map)
munmap(map, mapsize);
- if (fd >= 0)
- close(fd);
return ret;
}
--
https://github.com/git/git/pull/344
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sha1_file: remove an used fd variable
2017-04-16 19:04 [PATCH] sha1_file: remove an used fd variable Sebastian Schuberth
@ 2017-04-17 1:41 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2017-04-17 1:41 UTC (permalink / raw
To: Sebastian Schuberth; +Cc: git
On Sun, Apr 16, 2017 at 07:04:01PM +0000, Sebastian Schuberth wrote:
> Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
> ---
> sha1_file.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/sha1_file.c b/sha1_file.c
> index 7106389..9ecf71f 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -3970,7 +3970,6 @@ int read_loose_object(const char *path,
> void **contents)
> {
> int ret = -1;
> - int fd = -1;
> void *map = NULL;
> unsigned long mapsize;
> git_zstream stream;
> @@ -4020,7 +4019,5 @@ int read_loose_object(const char *path,
> out:
> if (map)
> munmap(map, mapsize);
> - if (fd >= 0)
> - close(fd);
> return ret;
Thanks, this looks obviously correct. The mistake is mine; in an early
iteration of the series, the caller of map_sha1_file_1() was responsible
for opening the file itself, but I later switched it to take the path.
-Peff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-17 1:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-16 19:04 [PATCH] sha1_file: remove an used fd variable Sebastian Schuberth
2017-04-17 1:41 ` Jeff King
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).