summaryrefslogtreecommitdiffhomepage
path: root/libbb
diff options
context:
space:
mode:
authorAlexander Shishkin <virtuoso@slind.org>2010-10-22 13:27:16 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-10-22 13:27:16 +0200
commit6722737ece4b8db3e30b53aef8f981f53db1621e (patch)
tree8e2ddb1d3a43d595ac4584e3d1ef23f49a462bf4 /libbb
parentcbfeaac7afe31323d46c52da3b98a949232d708e (diff)
*: introduce and use xmkstemp. -65 bytes.
Signed-off-by: Alexander Shishkin <virtuoso@slind.org> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/xfuncs_printf.c8
1 files changed, 8 insertions, 0 deletions
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)
{