mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Back out ftruncate error handling. There can some file tipes
f.e. sockets when ftruncate normally fail.
This commit is contained in:
parent
627a09e3c1
commit
6f8d08b39a
1 changed files with 2 additions and 9 deletions
|
|
@ -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…
Reference in a new issue