{"thread":{"id":"45714","subject":"[PATCH] sha1_file: remove an used fd variable","startedAt":"2017-04-16T19:04:07Z","lastAt":"2017-04-17T01:41:48Z","messageCount":2,"participants":["Sebastian Schuberth","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"316957","messageId":"0102015b7826824a-7bacaa78-5158-4d33-9615-e1a5bffea7a2-000000@eu-west-1.amazonses.com","threadId":"45714","inReplyTo":null,"subject":"[PATCH] sha1_file: remove an used fd variable","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2017-04-16T19:04:01Z","receivedAt":"2017-04-16T19:04:07Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>\n---\n sha1_file.c | 3 ---\n 1 file changed, 3 deletions(-)\n\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 7106389..9ecf71f 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -3970,7 +3970,6 @@ int read_loose_object(const char *path,\n \t\t      void **contents)\n {\n \tint ret = -1;\n-\tint fd = -1;\n \tvoid *map = NULL;\n \tunsigned long mapsize;\n \tgit_zstream stream;\n@@ -4020,7 +4019,5 @@ int read_loose_object(const char *path,\n out:\n \tif (map)\n \t\tmunmap(map, mapsize);\n-\tif (fd >= 0)\n-\t\tclose(fd);\n \treturn ret;\n }\n\n--\nhttps://github.com/git/git/pull/344\n"},{"id":"316977","messageId":"20170417014140.gxto2q76v6ajxwd3@sigill.intra.peff.net","threadId":"45714","inReplyTo":"0102015b7826824a-7bacaa78-5158-4d33-9615-e1a5bffea7a2-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH] sha1_file: remove an used fd variable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-04-17T01:41:41Z","receivedAt":"2017-04-17T01:41:48Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Apr 16, 2017 at 07:04:01PM +0000, Sebastian Schuberth wrote:\n\n> Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>\n> ---\n>  sha1_file.c | 3 ---\n>  1 file changed, 3 deletions(-)\n> \n> diff --git a/sha1_file.c b/sha1_file.c\n> index 7106389..9ecf71f 100644\n> --- a/sha1_file.c\n> +++ b/sha1_file.c\n> @@ -3970,7 +3970,6 @@ int read_loose_object(const char *path,\n>  \t\t      void **contents)\n>  {\n>  \tint ret = -1;\n> -\tint fd = -1;\n>  \tvoid *map = NULL;\n>  \tunsigned long mapsize;\n>  \tgit_zstream stream;\n> @@ -4020,7 +4019,5 @@ int read_loose_object(const char *path,\n>  out:\n>  \tif (map)\n>  \t\tmunmap(map, mapsize);\n> -\tif (fd >= 0)\n> -\t\tclose(fd);\n>  \treturn ret;\n\nThanks, this looks obviously correct. The mistake is mine; in an early\niteration of the series, the caller of map_sha1_file_1() was responsible\nfor opening the file itself, but I later switched it to take the path.\n\n-Peff\n"}]}