summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/freopen.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2006-10-16 09:39:15 +0000
committerache <ache@FreeBSD.org>2006-10-16 09:39:15 +0000
commit5b6b5391fa3474ffe69c4ed7f7547e19c23aef39 (patch)
tree9644e648edb9edc34026b520be130ec082cd5e03 /lib/libc/stdio/freopen.c
parent099609fe2f5539ad5ed2ccaa213d9ec7131a4e2a (diff)
downloadFreeBSD-src-5b6b5391fa3474ffe69c4ed7f7547e19c23aef39.zip
FreeBSD-src-5b6b5391fa3474ffe69c4ed7f7547e19c23aef39.tar.gz
Back out ftruncate error handling. There can some file tipes
f.e. sockets when ftruncate normally fail.
Diffstat (limited to 'lib/libc/stdio/freopen.c')
-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