[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-stable
Subject:    Re: lseek(SEEK_END) then read()... bug of feature?
From:       Tai-hwa Liang <avatar () mmlab ! cse ! yzu ! edu ! tw>
Date:       2001-06-29 0:49:15
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic