Back out ftruncate error handling. There can some file tipes

f.e. sockets when ftruncate normally fail.
This commit is contained in:
Andrey A. Chernov 2006-10-16 09:39:15 +00:00
parent 627a09e3c1
commit 6f8d08b39a

View File

@ -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) {