Commits

Luiz Fernando N. Capitulino  committed f21a47b

Introduces xmkstemp()

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>

  • Participants
  • Parent commits eef427a

Comments (0)

Files changed (1)

File git-compat-util.h

 	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;