From 6f8d08b39a31b65b09bbb99fc6531c345f7698e7 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Mon, 16 Oct 2006 09:39:15 +0000 Subject: Back out ftruncate error handling. There can some file tipes f.e. sockets when ftruncate normally fail. --- lib/libc/stdio/freopen.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index bbf039a96ee8..bc2e831e4d90 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) { -- cgit v1.2.3