diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2006-10-16 09:39:15 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2006-10-16 09:39:15 +0000 |
| commit | 6f8d08b39a31b65b09bbb99fc6531c345f7698e7 (patch) | |
| tree | 9644e648edb9edc34026b520be130ec082cd5e03 | |
| parent | 627a09e3c1a983028f5fe91d8d1747a47eee1014 (diff) | |
Notes
| -rw-r--r-- | lib/libc/stdio/freopen.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index bbf039a96ee8d..bc2e831e4d902 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) { |
