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>
This commit is contained in:
committed by
Junio C Hamano
parent
eef427a09c
commit
f21a47b27c
@ -303,6 +303,16 @@ static inline FILE *xfdopen(int fd, const char *mode)
|
|||||||
return stream;
|
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)
|
static inline size_t xsize_t(off_t len)
|
||||||
{
|
{
|
||||||
return (size_t)len;
|
return (size_t)len;
|
||||||
|
|||||||
Reference in New Issue
Block a user