got patch: re-add forgotten lseek otherwise got-read-patch can't parse any patch because the position indicator is at the end of file. While here fix the return too and set patchfd to -1 on error (stsp suggestion.) ok thomas, stsp
diff --git a/got/got.c b/got/got.c
index 175740d..17d637c 100644
--- a/got/got.c
+++ b/got/got.c
@@ -7150,9 +7150,15 @@ patch_from_stdin(int *patchfd)
signal(SIGINT, sigint);
signal(SIGQUIT, sigquit);
- if (err != NULL)
+ if (err == NULL && lseek(*patchfd, 0, SEEK_SET) == -1)
+ err = got_error_from_errno("lseek");
+
+ if (err != NULL) {
close(*patchfd);
- return NULL;
+ *patchfd = -1;
+ }
+
+ return err;
}
static const struct got_error *