diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-09-01 14:40:01 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-09-01 14:40:01 +0000 |
| commit | 45892fd8558219a7cd1530c956263e01c6aa1541 (patch) | |
| tree | 676a57eb64f3349c798379fdbbb069ed5cebc034 /lib/libc/stdio/fseek.c | |
| parent | 3c4d9468b005a9f0eade229099984af1670448e9 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdio/fseek.c')
| -rw-r--r-- | lib/libc/stdio/fseek.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c index d06e40887f32..b2d98a933a94 100644 --- a/lib/libc/stdio/fseek.c +++ b/lib/libc/stdio/fseek.c @@ -131,8 +131,12 @@ _fseeko(fp, offset, whence, ltest) */ if (_ftello(fp, &curoff)) return (-1); - if ((offset > 0 && curoff > OFF_MAX - offset) || - (offset < 0 && curoff < OFF_MIN - offset)) { + if (curoff < 0) { + /* Unspecified position because of ungetc() at 0 */ + errno = ESPIPE; + return (-1); + } + if (offset > 0 && curoff > OFF_MAX - offset) { errno = EOVERFLOW; return (-1); } |
