projects
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eef427a
)
Introduces xmkstemp()
author
Luiz Fernando N. Capitulino
<lcapitulino@mandriva.com.br>
Tue, 14 Aug 2007 19:44:53 +0000
(16:44 -0300)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 15 Aug 2007 05:20:23 +0000
(22:20 -0700)
This is a wrapper for mkstemp() that performs error checking and
calls die() when an error occur.
Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-compat-util.h
patch
|
blob
|
history
diff --git
a/git-compat-util.h
b/git-compat-util.h
index 362e040f52cf8df17811ae95e46f0b60d2b6f071..ca0a597a282328bff9e0e29fd3653dbd656489fb 100644
(file)
--- 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;