git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] Introduces xmkstemp()

From
LCLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Date
Aug 14, 2007, 19:44 UTC
Message-ID
<20070814164453.400b9c55@localhost>

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
Next: Carlos Rica
Message 1 of 13 in “Introduces xmkstemp()”
  1. 1/2 Introduces xmkstemp()Luiz Fernando N. Capitulino, Aug 14, 2007
  2. Carlos RicaAug 15, 2007
  3. Luiz Fernando N. CapitulinoAug 15, 2007
  4. Carlos RicaAug 15, 2007
  5. Marius Storm-OlsenAug 31, 2007
  6. Johannes SixtAug 31, 2007
  7. Marius Storm-OlsenAug 31, 2007
  8. Johannes SixtAug 31, 2007
  9. Marius Storm-OlsenAug 31, 2007
  10. MinGW merge plans, was Re: [PATCH 1/2] Introduces xmkstemp()Johannes Schindelin, Aug 31, 2007
  11. Johannes SixtAug 31, 2007
  12. Luiz Fernando N. CapitulinoAug 31, 2007
  13. Luiz Fernando N. CapitulinoAug 31, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.