First thing that I can think of after looking
at the code is data corruption at some point in the file.

When you use findplayer() it tries to fetch index (in case
you use PLAYER_INDEX) or sequentially fetch records of
sizeof(struct statentry). In both cases if the file has
at some point one wrong record (different size) all following
records will become junk (because of wrong record offset).

So technically when you have such corruption you will always
fail to find player's record in the .players (no matter whether
you do or do not use gdbm).

On the other side when you fail to add player you just seek
to the end of the file and add new record.

Easiest way to find out is to read all .players in loop
and print player name. At some point you should start getting
junk. Trim to the last normal record and it should be ok.
Don't really know if it will be practical to use solution I gave
(in case this is the problem), but you get the idea.

Even if it isn't the case it would be better (IMO) to get rid
of direct access to file and just use some kind of hash database
instead (same dbm as used for indexes ?).

Hopefully it helps.


On Thu, 23 Dec 2004, James Cameron wrote:

> Date: Thu, 23 Dec 2004 10:25:58 +1100
> From: James Cameron <quozl at>
> Reply-To: Vanilla Netrek Development Mailing List
>     <vanilla-devel at>
> To: vanilla-devel at
> Subject: [Vanilla Devel]  .players growing, newly created characters not found
> Anyone seen this problem or can think of any causes?
> Old characters can be used fine.  Username and password work, and the
> stats look fine.
> New characters can be created; .players grows accordingly.  But trying
> to log in to the new character a second time results in the same
> behaviour as if the character is not on file.  .players grows again.
> -- 
> James Cameron    mailto:quozl at
> _______________________________________________
> vanilla-devel mailing list
> vanilla-devel at

vanilla-devel mailing list
vanilla-devel at