fix missed dup in open_blob per stsp@
diff --git a/lib/object.c b/lib/object.c
index 08567c7..a2fb22f 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -1352,7 +1352,7 @@ open_blob(struct got_blob_object **blob, struct got_repository *repo,
{
const struct got_error *err = NULL;
struct got_packidx *packidx = NULL;
- int idx;
+ int idx, dfd = -1;
char *path_packfile = NULL;
uint8_t *outbuf;
size_t size, hdrlen;
@@ -1422,11 +1422,17 @@ open_blob(struct got_blob_object **blob, struct got_repository *repo,
goto done;
}
+ dfd = dup(outfd);
+ if (dfd == -1) {
+ err = got_error_from_errno("dup");
+ goto done;
+ }
+
(*blob)->f = fdopen(outfd, "rb");
if ((*blob)->f == NULL) {
err = got_error_from_errno("fdopen");
- close(outfd);
- outfd = -1;
+ close(dfd);
+ dfd = -1;
goto done;
}
}