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 --- coreutils/dos2unix.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'coreutils/dos2unix.c') diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index ba1ca8c79..eab8110dc 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c @@ -41,12 +41,10 @@ static void convert(char *fn, int conv_type) fstat(fileno(in), &st); temp_fn = xasprintf("%sXXXXXX", resolved_fn); - i = mkstemp(temp_fn); - if (i == -1 - || fchmod(i, st.st_mode) == -1 - ) { + i = xmkstemp(temp_fn); + if (fchmod(i, st.st_mode) == -1) bb_simple_perror_msg_and_die(temp_fn); - } + out = xfdopen_for_write(i); } -- cgit v1.2.3