commit - bfbccd0a546344106bb6e22074678a396d7bcad0
commit + 6f5cb1bdf76f3043ac81d413349d354738180769
blob - 84226a57dca7da7a69187a76d804e8ceda7558ba
blob + 672f8dac069d4fdcde1088037bbf462287cd0264
--- lib/patch.c
+++ lib/patch.c
const struct got_error *err = NULL;
struct got_pathlist_head paths;
struct got_pathlist_entry *pe;
- char *path = NULL, *tmppath = NULL;
+ char *path = NULL, *tmppath = NULL, *template = NULL;
FILE *orig = NULL, *tmp = NULL;
struct got_patch_hunk *h;
size_t i;
goto done;
}
- err = got_opentemp_named(&tmppath, &tmp,
- got_worktree_get_root_path(worktree));
+ if (asprintf(&template, "%s/got-patch",
+ got_worktree_get_root_path(worktree)) == -1) {
+ err = got_error_from_errno(template);
+ goto done;
+ }
+
+ err = got_opentemp_named(&tmppath, &tmp, template);
if (err)
goto done;
else
printf("M %s\n", path); /* XXX */
done:
+ free(template);
if (err != NULL && p->old == NULL && path != NULL)
unlink(path);
if (tmp != NULL)