Commit Diff


commit - ffb286fde07ce8906a7ecb685243f7695153a76b
commit + 81984c6becccdb4bc5c55d06dcfd509784910c85
blob - 50ba94ad8edbebe6656a16cac05290d29cc8a4d9
blob + b7496e3bd89e5a8bd78393ea432db0937fbd0b57
--- lib/object_create.c
+++ lib/object_create.c
@@ -48,7 +48,7 @@ got_object_blob_create(struct got_object_id **id, stru
     const char *ondisk_path)
 {
 	const struct got_error *err = NULL, *unlock_err = NULL;
-	char *header = NULL, *blobpath = NULL, *objpath = NULL, *outpath = NULL;
+	char *header = NULL, *objpath = NULL, *outpath = NULL;
 	FILE *blobfile = NULL, *outfile = NULL;
 	int fd = -1;
 	struct stat sb;
@@ -78,9 +78,11 @@ got_object_blob_create(struct got_object_id **id, stru
 	headerlen = strlen(header) + 1;
 	SHA1Update(&sha1_ctx, header, headerlen);
 
-	err = got_opentemp_named(&blobpath, &blobfile, "/tmp/got-blob-create");
-	if (err)
+	blobfile = got_opentemp();
+	if (blobfile == NULL) {
+		err = got_error_from_errno();
 		goto done;
+	}
 
 	outlen = fwrite(header, 1, headerlen, blobfile);
 	if (outlen != headerlen) {
@@ -150,7 +152,6 @@ got_object_blob_create(struct got_object_id **id, stru
 	}
 done:
 	free(header);
-	free(blobpath);
 	if (outpath) {
 		if (unlink(outpath) != 0 && err == NULL)
 			err = got_error_from_errno();