}
}
+static void activate_tempfile(struct tempfile *tempfile)
+{
+ tempfile->owner = getpid();
+ tempfile->active = 1;
+}
+
/* Make sure errno contains a meaningful value on error */
int create_tempfile(struct tempfile *tempfile, const char *path)
{
strbuf_reset(&tempfile->filename);
return -1;
}
- tempfile->owner = getpid();
- tempfile->active = 1;
+ activate_tempfile(tempfile);
if (adjust_shared_perm(tempfile->filename.buf)) {
int save_errno = errno;
error("cannot fix permission bits on %s", tempfile->filename.buf);
{
prepare_tempfile_object(tempfile);
strbuf_add_absolute_path(&tempfile->filename, path);
- tempfile->owner = getpid();
- tempfile->active = 1;
+ activate_tempfile(tempfile);
}
int mks_tempfile_sm(struct tempfile *tempfile,
strbuf_reset(&tempfile->filename);
return -1;
}
- tempfile->owner = getpid();
- tempfile->active = 1;
+ activate_tempfile(tempfile);
return tempfile->fd;
}
strbuf_reset(&tempfile->filename);
return -1;
}
- tempfile->owner = getpid();
- tempfile->active = 1;
+ activate_tempfile(tempfile);
return tempfile->fd;
}