[comp.sources.games.bugs] sun-tetris1 - Patch1

iwamoto%scoopybear@Sun.COM (Rick Iwamoto) (04/05/89)

There is a bug in the update_hs (update highscores) routine which has
effect on many people using the same highscore file.  The patch for this
follows.
Also, some people's systems have trouble with the lockf() calls in the
update_hs() routine.  Those people may see some message about "fcntl"
or their systems may hang for a bit.  Those lockf() calls (there are
two calls) can be removed if you see anything like this.

-Rick

*** suntetris_pw.c.OLD	Tue Apr  4 16:42:12 1989
--- suntetris_pw.c	Mon Apr  3 16:07:26 1989
***************
*** 1,5 ****
  #ifndef lint
! static char sccsid[] = "@(#)suntetris_pw.c	1.14 3/23/89";
  #endif
  /*
   *  Copyright 1989, Rick Iwamoto iwamoto@sun.com
--- 1,5 ----
  #ifndef lint
! static char sccsid[] = "@(#)suntetris_pw.c	1.15 4/3/89";
  #endif
  /*
   *  Copyright 1989, Rick Iwamoto iwamoto@sun.com
***************
*** 478,484 ****
  int score, level;
  {
      FILE *fp;
!     int i, j;
      struct passwd *passwd = getpwuid (getuid ());
  
      if ((fp = fopen (HIGHSCOREFILE, "r")) != NULL)  {	/* read old scores */
--- 478,484 ----
  int score, level;
  {
      FILE *fp;
!     int i = 0, j;
      struct passwd *passwd = getpwuid (getuid ());
  
      if ((fp = fopen (HIGHSCOREFILE, "r")) != NULL)  {	/* read old scores */