All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Introduces xmkstemp()
@ 2007-08-14 19:44 Luiz Fernando N. Capitulino
  2007-08-15 15:11 ` Carlos Rica
  2007-08-31  8:27 ` Marius Storm-Olsen
  0 siblings, 2 replies; 13+ messages in thread
From: Luiz Fernando N. Capitulino @ 2007-08-14 19:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git


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>
---
 git-compat-util.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 362e040..ca0a597 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;
-- 
1.5.3.GIT



-- 
Luiz Fernando N. Capitulino

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-08-31 16:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-14 19:44 [PATCH 1/2] Introduces xmkstemp() Luiz Fernando N. Capitulino
2007-08-15 15:11 ` Carlos Rica
2007-08-15 16:17   ` Luiz Fernando N. Capitulino
2007-08-15 16:47     ` Carlos Rica
2007-08-31  8:27 ` Marius Storm-Olsen
2007-08-31  8:34   ` Johannes Sixt
2007-08-31  8:42     ` Marius Storm-Olsen
2007-08-31  8:49       ` Johannes Sixt
2007-08-31  9:00         ` Marius Storm-Olsen
2007-08-31 12:03           ` MinGW merge plans, was " Johannes Schindelin
2007-08-31 13:13             ` Johannes Sixt
2007-08-31 16:57         ` Luiz Fernando N. Capitulino
2007-08-31 12:48       ` Luiz Fernando N. Capitulino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.