*BSD News Article 50681


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!daffy!uwvax!uchinews!ncar!newsfeed.internetmci.com!howland.reston.ans.net!news.sprintlink.net!in2.uu.net!vixie!nnrp.vix.com!vixie
From: vixie@wisdom.vix.com (Paul A Vixie)
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: Major bug?  (probably programmer error :)
Date: 04 Sep 1995 18:22:51 GMT
Organization: Vixie Enterprises
Lines: 21
Message-ID: <VIXIE.95Sep4112251@wisdom.vix.com>
References: <42ff8m$b3d@clarknet.clark.net>
NNTP-Posting-Host: wisdom.home.vix.com
In-reply-to: alweiner@clark.net's message of 4 Sep 1995 18:07:18 GMT

>	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.
-- 
Paul Vixie
La Honda, CA			"Illegitimi non carborundum."
<paul@vix.com>
pacbell!vixie!paul		(dont let the bastards grind you down)