From owner-freebsd-stable Thu Jun 28 17:49: 6 2001 Delivered-To: freebsd-stable@freebsd.org Received: from www.mmlab.cse.yzu.edu.tw (www.mmlab.cse.yzu.edu.tw [140.138.145.166]) by hub.freebsd.org (Postfix) with SMTP id B311237B401 for ; Thu, 28 Jun 2001 17:49:01 -0700 (PDT) (envelope-from avatar@mmlab.cse.yzu.edu.tw) Received: (qmail 79682 invoked from network); 29 Jun 2001 00:49:15 -0000 Received: from www.mmlab.cse.yzu.edu.tw (@140.138.145.166) by www.mmlab.cse.yzu.edu.tw with SMTP; 29 Jun 2001 00:49:15 -0000 Date: Fri, 29 Jun 2001 08:49:15 +0800 (CST) From: Tai-hwa Liang To: John Polstra Cc: Subject: Re: lseek(SEEK_END) then read()... bug of feature? In-Reply-To: <200106281452.f5SEqxf93857@vashon.polstra.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 28 Jun 2001, John Polstra wrote: [...] > > off_t offset; > > int ret, fd = open("/kernel", O_RDONLY); > > > > offset = 0 - sizeof(int); > > Due to C's type promotion rules, this assigns the value 4294967292 > to "offset". Change it to this: > > offset = (off_t)0 - sizeof(int); > > and your program works fine. > Ah, that did the trick! Thanks a lot for your information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message