*BSD News Article 50662


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!zombie.ncsc.mil!admaix.sunydutchess.edu!ub!news.kei.com!news.mathworks.com!tank.news.pipex.net!pipex!news.sprintlink.net!news.clark.net!usenet
From: alweiner@clark.net (Alan Weiner)
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: Major bug?  (probably programmer error :)
Date: 4 Sep 1995 20:58:53 GMT
Organization: GRYPHON Microproducts
Lines: 20
Message-ID: <42fpad$rie@clarknet.clark.net>
References: <42ff8m$b3d@clarknet.clark.net> <VIXIE.95Sep4112251@wisdom.vix.com>
NNTP-Posting-Host: alweiner.clark.net
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: WinVN NT 0.92.6

In article <VIXIE.95Sep4112251@wisdom.vix.com>, vixie@wisdom.vix.com (Paul A Vixie) says:
>
>>       lseek(fd,-1L*sizeof(b),1);
>>       write(fd,&b,sizeof(b));
>>
>> Try running the following program on your BSDI system.  I think you'll be
>> supprized at the resulting test.txt.
>
>Nope, no surprises here.
>
>> Am I doing something illegal here?
>
>Try this:
>
>        printf("offset: %ld\n", -1L*sizeof(b));
>
>What you've done is to create a sparse file.  Only the blocks you've written
>on will be allocated.  Try "ls -ls test.txt" and you'll see what I mean.

Doesn't -1L*sizeof(b) do an implicit conversion to long?