Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/canfield/canfield Use ssize_t for read() results. Don'...



details:   https://anonhg.NetBSD.org/src/rev/e98463b31134
branches:  trunk
changeset: 794732:e98463b31134
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Mar 22 23:47:03 2014 +0000

description:
Use ssize_t for read() results. Don't use int for lseek() results.
Call srandom() with time(), not getpid().

diffstat:

 games/canfield/canfield/canfield.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 3964313f2477 -r e98463b31134 games/canfield/canfield/canfield.c
--- a/games/canfield/canfield/canfield.c        Sat Mar 22 23:45:34 2014 +0000
+++ b/games/canfield/canfield/canfield.c        Sat Mar 22 23:47:03 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: canfield.c,v 1.29 2014/03/22 23:42:48 dholland Exp $   */
+/*     $NetBSD: canfield.c,v 1.30 2014/03/22 23:47:03 dholland Exp $   */
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: canfield.c,v 1.29 2014/03/22 23:42:48 dholland Exp $");
+__RCSID("$NetBSD: canfield.c,v 1.30 2014/03/22 23:47:03 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -1637,9 +1637,9 @@
 static void
 initall(void)
 {
-       int i;
+       ssize_t i;
 
-       srandom(getpid());
+       srandom(time(NULL));
        time(&acctstart);
        initdeck(deck);
        uid = getuid();
@@ -1652,8 +1652,7 @@
                return;
        if (dbfd < 3)
                exit(1);
-       i = lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET);
-       if (i < 0) {
+       if (lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET) < 0) {
                close(dbfd);
                dbfd = -1;
                return;



Home | Main Index | Thread Index | Old Index