Back out ftruncate error handling. There can some file tipes

f.e. sockets when ftruncate normally fail.
This commit is contained in:
ache 2006-10-16 09:39:15 +00:00
parent 099609fe2f
commit 5b6b5391fa

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