From owner-freebsd-bugs Fri Aug 10 12:49:33 2001 Delivered-To: freebsd-bugs@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 3AA3437B405; Fri, 10 Aug 2001 12:49:25 -0700 (PDT) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.11.4/8.11.4) id f7AJnNT15358; Fri, 10 Aug 2001 23:49:24 +0400 (MSD) (envelope-from ache) Date: Fri, 10 Aug 2001 23:49:23 +0400 From: "Andrey A. Chernov" To: arch@FreeBSD.ORG Cc: bugs@FreeBSD.ORG Subject: Re: CFR: fseek<0 + feof error (with fix) Message-ID: <20010810234922.A15324@nagual.pp.ru> References: <20010810232939.A14964@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010810232939.A14964@nagual.pp.ru> User-Agent: Mutt/1.3.19i Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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