From 6722737ece4b8db3e30b53aef8f981f53db1621e Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Fri, 22 Oct 2010 13:27:16 +0200 Subject: *: introduce and use xmkstemp. -65 bytes. Signed-off-by: Alexander Shishkin Signed-off-by: Denys Vlasenko --- libbb/xfuncs_printf.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libbb/xfuncs_printf.c') diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c index ba660a2db..56ee459e4 100644 --- a/libbb/xfuncs_printf.c +++ b/libbb/xfuncs_printf.c @@ -240,6 +240,14 @@ off_t FAST_FUNC xlseek(int fd, off_t offset, int whence) return off; } +int FAST_FUNC xmkstemp(char *template) +{ + int fd = mkstemp(template); + if (fd < 0) + bb_perror_msg_and_die("can't create temp file '%s'", template); + return fd; +} + // Die with supplied filename if this FILE* has ferror set. void FAST_FUNC die_if_ferror(FILE *fp, const char *fn) { -- cgit v1.2.3