From a988826d5cdd58c51ed6c38a0b02d674b6631e76 Mon Sep 17 00:00:00 2001 From: jsm Date: Fri, 31 Aug 2001 07:17:02 +0000 Subject: Always lseek back to the beginning of the file in post(), which may be called twice in a game if a bonus occurs. Patch from Malcolm Parsons . --- snake/snake/snake.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'snake') diff --git a/snake/snake/snake.c b/snake/snake/snake.c index 908b6542..52fe4795 100644 --- a/snake/snake/snake.c +++ b/snake/snake/snake.c @@ -1,4 +1,4 @@ -/* $NetBSD: snake.c,v 1.16 2000/05/08 07:56:05 mycroft Exp $ */ +/* $NetBSD: snake.c,v 1.17 2001/08/31 07:17:02 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94"; #else -__RCSID("$NetBSD: snake.c,v 1.16 2000/05/08 07:56:05 mycroft Exp $"); +__RCSID("$NetBSD: snake.c,v 1.17 2001/08/31 07:17:02 jsm Exp $"); #endif #endif /* not lint */ @@ -541,8 +541,10 @@ post(iscore, flag) read(rawscores, &allbwho, sizeof(short)); lseek(rawscores, uid * sizeof(short), SEEK_SET); read(rawscores, &oldbest, sizeof(short)); - if (!flag) + if (!flag) { + lseek(rawscores, 0, SEEK_SET); return (score > oldbest ? 1 : 0); + } /* Update this jokers best */ if (score > oldbest) { -- cgit v1.2.3-56-ge451