diff options
author | Alexander Shishkin <virtuoso@slind.org> | 2010-10-22 13:27:16 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-10-22 13:27:16 +0200 |
commit | 6722737ece4b8db3e30b53aef8f981f53db1621e (patch) | |
tree | 8e2ddb1d3a43d595ac4584e3d1ef23f49a462bf4 /libbb/xfuncs_printf.c | |
parent | cbfeaac7afe31323d46c52da3b98a949232d708e (diff) | |
download | busybox-w32-6722737ece4b8db3e30b53aef8f981f53db1621e.tar.gz busybox-w32-6722737ece4b8db3e30b53aef8f981f53db1621e.tar.bz2 busybox-w32-6722737ece4b8db3e30b53aef8f981f53db1621e.zip |
*: 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/xfuncs_printf.c')
-rw-r--r-- | libbb/xfuncs_printf.c | 8 |
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) | |||
240 | return off; | 240 | return off; |
241 | } | 241 | } |
242 | 242 | ||
243 | int FAST_FUNC xmkstemp(char *template) | ||
244 | { | ||
245 | int fd = mkstemp(template); | ||
246 | if (fd < 0) | ||
247 | bb_perror_msg_and_die("can't create temp file '%s'", template); | ||
248 | return fd; | ||
249 | } | ||
250 | |||
243 | // Die with supplied filename if this FILE* has ferror set. | 251 | // Die with supplied filename if this FILE* has ferror set. |
244 | void FAST_FUNC die_if_ferror(FILE *fp, const char *fn) | 252 | void FAST_FUNC die_if_ferror(FILE *fp, const char *fn) |
245 | { | 253 | { |