Code

GIT 1.5.3-rc6
[git.git] / git-compat-util.h
index 362e040f52cf8df17811ae95e46f0b60d2b6f071..ca0a597a282328bff9e0e29fd3653dbd656489fb 100644 (file)
@@ -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;