X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-compat-util.h;h=ca0a597a282328bff9e0e29fd3653dbd656489fb;hb=38762c47d6442dc0ce0f45533f9151877c485337;hp=362e040f52cf8df17811ae95e46f0b60d2b6f071;hpb=82ff9d2c8b0d449fbaae21a69bcc3b98a4012180;p=git.git diff --git a/git-compat-util.h b/git-compat-util.h index 362e040f5..ca0a597a2 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -303,6 +303,16 @@ static inline FILE *xfdopen(int fd, const char *mode) return stream; } +static inline int xmkstemp(char *template) +{ + int fd; + + fd = mkstemp(template); + if (fd < 0) + die("Unable to create temporary file: %s", strerror(errno)); + return fd; +} + static inline size_t xsize_t(off_t len) { return (size_t)len;