commit - f970685c28a69b4ad4cb94b882bec962b274022f
commit + 51130c027d3d769ca63c1d9051231791ad5f2f39
blob - 811852390009b439b1fa0ba6e06034eaee832a4f
blob + cbb6de133806483e00d1d51b5acffb2ebf00b01b
--- lib/object_create.c
+++ lib/object_create.c
#include <sys/stat.h>
#include <sys/queue.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
goto done;
err = got_opentemp_named(&outpath, &outfile, objpath);
- if (err)
- goto done;
+ if (err) {
+ char *parent_path;
+ if (!(err->code == GOT_ERR_ERRNO && errno == ENOENT))
+ goto done;
+ err = got_path_dirname(&parent_path, objpath);
+ if (err)
+ goto done;
+ err = got_path_mkdir(parent_path);
+ free(parent_path);
+ if (err)
+ goto done;
+ err = got_opentemp_named(&outpath, &outfile, objpath);
+ if (err)
+ goto done;
+ }
err = got_deflate_to_file(&outlen, blobfile, outfile);
if (err)