commit - 3b01d641c14e67930d70d9cc5fb8b06d0f782033
commit + 4027dbc25c21bad271f5406e382054c6095523bc
blob - 20b4e1e2357e5e26d85170030eb53e9f387807e0
blob + 59e2c3f9430e3ca55e7c81bba6faf5e7222d2d4f
--- lib/patch.c
+++ lib/patch.c
const struct got_error *err = NULL;
struct got_patch_hunk *h;
struct stat sb;
- size_t i;
long lineno = 0;
FILE *orig;
off_t copypos, pos;
return got_error(GOT_ERR_PATCH_MALFORMED);
if (nop)
return NULL;
- for (i = 0; i < h->len; ++i) {
- if (fprintf(tmp, "%s", h->lines[i] + 1) < 0)
- return got_error_from_errno("fprintf");
- }
- return err;
+ return apply_hunk(tmp, h, &lineno);
}
if ((orig = fopen(path, "r")) == NULL) {