Date: Fri, 10 Aug 2001 23:49:23 +0400 From: "Andrey A. Chernov" <ache@nagual.pp.ru> To: arch@FreeBSD.ORG Cc: bugs@FreeBSD.ORG Subject: Re: CFR: fseek<0 + feof error (with fix) Message-ID: <20010810234922.A15324@nagual.pp.ru> In-Reply-To: <20010810232939.A14964@nagual.pp.ru> References: <20010810232939.A14964@nagual.pp.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 10, 2001 at 23:29:40 +0400, Andrey A. Chernov wrote:
> offset += curoff;
> + if (offset < 0) {
> + errno = EINVAL;
> + return (EOF);
> + }
Correction.
I just examine POSIX more carefully and found that EINVAL should be
returned only if whence argument is negative for SEEK_SET since it is
direct incorrect usage. For SEEK_CUR and SEEK_END there different errno
supposed because they are computations:
[EOVERFLOW]
For fseek(), the resulting file offset would be a value which cannot be
represented correctly in an object of type long.
[EOVERFLOW]
For fseeko(), the resulting file offset would be a value which cannot be
represented correctly in an object of type off_t.
I.e. one place of my patch stays errno = EINVAL; and two other places will
be now errno = EOVERFLOW;
--
Andrey A. Chernov
http://ache.pp.ru/
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010810234922.A15324>
