git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luiz Fernando N. Capitulino" <lcapitulino@mandriva.com.br>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 1/2] Introduces xmkstemp()
Date: Tue, 14 Aug 2007 16:44:53 -0300	[thread overview]
Message-ID: <20070814164453.400b9c55@localhost> (raw)


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

             reply	other threads:[~2007-08-14 19:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-14 19:44 Luiz Fernando N. Capitulino [this message]
2007-08-15 15:11 ` [PATCH 1/2] Introduces xmkstemp() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070814164453.400b9c55@localhost \
    --to=lcapitulino@mandriva.com.br \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).