Back out ftruncate error handling. There can some file tipes
f.e. sockets when ftruncate normally fail.
This commit is contained in:
parent
099609fe2f
commit
5b6b5391fa
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user