/* Make sure errno contains a meaningful value on error */
struct tempfile *create_tempfile_mode(const char *path, int mode)
+{
+ return repo_create_tempfile_mode(the_repository, path, mode);
+}
+
+struct tempfile *repo_create_tempfile_mode(struct repository *r,
+ const char *path, int mode)
{
struct tempfile *tempfile = new_tempfile();
return NULL;
}
activate_tempfile(tempfile);
- if (adjust_shared_perm(the_repository, tempfile->filename.buf)) {
+ if (adjust_shared_perm(r, tempfile->filename.buf)) {
int save_errno = errno;
error("cannot fix permission bits on %s", tempfile->filename.buf);
delete_tempfile(&tempfile);
#include "list.h"
#include "strbuf.h"
+struct repository;
+
/*
* Handle temporary files.
*
*/
struct tempfile *create_tempfile_mode(const char *path, int mode);
+struct tempfile *repo_create_tempfile_mode(struct repository *r,
+ const char *path, int mode);
+
static inline struct tempfile *create_tempfile(const char *path)
{
return create_tempfile_mode(path, 0666);
}
+static inline struct tempfile *repo_create_tempfile(struct repository *r,
+ const char *path)
+{
+ return repo_create_tempfile_mode(r, path, 0666);
+}
+
/*
* Register an existing file as a tempfile, meaning that it will be
* deleted when the program exits. The tempfile is considered closed,