summaryrefslogtreecommitdiff
path: root/coreutils/dos2unix.c
diff options
context:
space:
mode:
authorAlexander Shishkin2010-10-22 13:27:16 +0200
committerDenys Vlasenko2010-10-22 13:27:16 +0200
commit6722737ece4b8db3e30b53aef8f981f53db1621e (patch)
tree8e2ddb1d3a43d595ac4584e3d1ef23f49a462bf4 /coreutils/dos2unix.c
parentcbfeaac7afe31323d46c52da3b98a949232d708e (diff)
downloadbusybox-6722737ece4b8db3e30b53aef8f981f53db1621e.zip
busybox-6722737ece4b8db3e30b53aef8f981f53db1621e.tar.gz
*: 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 'coreutils/dos2unix.c')
-rw-r--r--coreutils/dos2unix.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index ba1ca8c..eab8110 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);
}