Subject: Re: "corrupt
To: Tom Ivar Helbekkmo <tih@eunetnorge.no>
From: None <itojun@iijlab.net>
List: tech-net
Date: 05/06/2004 18:00:30
>> 	even though i always stop dhclient by "dhclient -r", i get "corrupt
>> 	lease file" error.  the error persists even if i remove the lease file
>> 	before invocation of dhclient (i see the error message starting from
>> 	2nd invocation).  any clues?
>
>I've been slightly irritated by that message, too, and I've peeked at
>the /var/run/dhclient.leases file from time to time.  It looks to me
>as if the file is overwritten instead of rewritten when a new set of
>leases is stored there, because the file has a number of still valid
>leases at the top, and then a number of outdated ones, of which the
>first is incomplete -- a random amount of the start of the record is
>overwritten.
>
>I'd look for a missing O_TRUNC, or a failing truncate(), or something.

	something has to be corrected in
	src/dist/dhcp/client/dhclient.c:rewrite_client_leases()
	but i'm not sure what is the right thing to do here.  is O_TRUNC
	appropriate?

itojun