commit - ac1c56620f5776671ec2b3e1b17ad82b05ad3dfb
commit + c6f826b4b8c649846845e38cd59168057e516ddc
blob - 35cbd8b8239ea074d03b5053e4750437a69e507d
blob + e544db91b3594ed04379bbd7e1cebaf60e1ca246
--- lib/object_create.c
+++ lib/object_create.c
struct got_repository *repo)
{
const struct got_error *err = NULL, *unlock_err = NULL;
- char *objpath = NULL, *outpath = NULL;
- FILE *outfile = NULL;
+ char *objpath = NULL, *tmppath = NULL;
+ FILE *tmpfile = NULL;
struct got_lockfile *lf = NULL;
- size_t outlen = 0;
+ size_t tmplen = 0;
err = got_object_get_path(&objpath, id, repo);
if (err)
return err;
- err = got_opentemp_named(&outpath, &outfile, objpath);
+ err = got_opentemp_named(&tmppath, &tmpfile, objpath);
if (err) {
char *parent_path;
if (!(err->code == GOT_ERR_ERRNO && errno == ENOENT))
free(parent_path);
if (err)
goto done;
- err = got_opentemp_named(&outpath, &outfile, objpath);
+ err = got_opentemp_named(&tmppath, &tmpfile, objpath);
if (err)
goto done;
}
- err = got_deflate_to_file(&outlen, content, outfile);
+ err = got_deflate_to_file(&tmplen, content, tmpfile);
if (err)
goto done;
if (err)
goto done;
- if (rename(outpath, objpath) != 0) {
+ if (rename(tmppath, objpath) != 0) {
err = got_error_from_errno();
goto done;
}
- free(outpath);
- outpath = NULL;
+ free(tmppath);
+ tmppath = NULL;
if (chmod(objpath, GOT_DEFAULT_FILE_MODE) != 0) {
err = got_error_from_errno();
}
done:
free(objpath);
- if (outpath) {
- if (unlink(outpath) != 0 && err == NULL)
+ if (tmppath) {
+ if (unlink(tmppath) != 0 && err == NULL)
err = got_error_from_errno();
- free(outpath);
+ free(tmppath);
}
- if (outfile && fclose(outfile) != 0 && err == NULL)
+ if (tmpfile && fclose(tmpfile) != 0 && err == NULL)
err = got_error_from_errno();
if (lf)
unlock_err = got_lockfile_unlock(lf);