X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=tempfile.h;h=4de3bc77d246ef5ceceabc42e64ae35a9960b26a;hb=35b43a107c1a146bef4591ae34fd2040bcd9944c;hp=cddda0a33c3e1ef39c6d294221fc9f7ae5205217;hpb=3ff6af7753287f2cac8261ae5184c3381373b836;p=thirdparty%2Fgit.git diff --git a/tempfile.h b/tempfile.h index cddda0a33c..4de3bc77d2 100644 --- a/tempfile.h +++ b/tempfile.h @@ -88,8 +88,16 @@ struct tempfile { * Attempt to create a temporary file at the specified `path`. Return * a tempfile (whose "fd" member can be used for writing to it), or * NULL on error. It is an error if a file already exists at that path. + * Note that `mode` will be further modified by the umask, and possibly + * `core.sharedRepository`, so it is not guaranteed to have the given + * mode. */ -struct tempfile *create_tempfile(const char *path); +struct tempfile *create_tempfile_mode(const char *path, int mode); + +static inline struct tempfile *create_tempfile(const char *path) +{ + return create_tempfile_mode(path, 0666); +} /* * Register an existing file as a tempfile, meaning that it will be