summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/freopen.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
index bbf039a..bc2e831 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -113,15 +113,8 @@ freopen(file, mode, fp)
return (NULL);
}
}
- if (oflags & O_TRUNC) {
- if (ftruncate(fp->_file, (off_t)0) < 0) {
- sverrno = errno;
- fclose(fp);
- FUNLOCKFILE(fp);
- errno = sverrno;
- return (NULL);
- }
- }
+ if (oflags & O_TRUNC)
+ (void) ftruncate(fp->_file, (off_t)0);
fp->_flags |= __SNPT; /* real seek */
if (_fseeko(fp, (off_t)0, oflags & O_APPEND ? SEEK_END : SEEK_SET,
0) < 0 && errno != ESPIPE) {
OpenPOWER on IntegriCloud