commit - 652b2703b30168d3a56716fd7bb2b1a4d9392069
commit + 4842267fac188afbe5e19be24bfce35fc2df19e8
blob - eb92f1cb845b67bd2049d7ca985579894a9c3220
blob + 3a8d465dfe9f909648697939e5bc8b3846ac1fbe
--- lib/object.c
+++ lib/object.c
}
static const struct got_error *
-read_object_header(struct got_object **obj, FILE *f)
+read_object_header(struct got_object **obj, int fd)
{
const struct got_error *err;
struct got_zstream_buf zb;
i = 0;
totlen = 0;
do {
- err = got_inflate_read(&zb, f, &outlen);
+ err = got_inflate_read_fd(&zb, fd, &outlen);
if (err)
goto done;
if (strchr(zb.outbuf, '\0') == NULL) {
const struct got_error *err = NULL;
struct got_object *obj = NULL;
struct imsgbuf ibuf;
- FILE *f = NULL;
int status = 0;
setproctitle("read object header");
goto done;
}
- f = fdopen(obj_fd, "rb");
- if (f == NULL) {
- err = got_error_from_errno();
- close(obj_fd);
- goto done;
- }
-
- err = read_object_header(&obj, f);
+ err = read_object_header(&obj, obj_fd);
if (err)
goto done;
got_privsep_send_error(&ibuf, err);
status = 1;
}
- if (f)
- fclose(f);
+ close(obj_fd);
imsg_clear(&ibuf);
close(imsg_fds[1]);
_exit(status);