Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/3964313f2477
branches:  trunk
changeset: 794731:3964313f2477
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Mar 22 23:45:34 2014 +0000

description:
Use ssize_t for read() results. Don't use int for lseek() results.

diffstat:

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

diffs (40 lines):

diff -r aeb437080412 -r 3964313f2477 games/canfield/cfscores/cfscores.c
--- a/games/canfield/cfscores/cfscores.c        Sat Mar 22 23:42:48 2014 +0000
+++ b/games/canfield/cfscores/cfscores.c        Sat Mar 22 23:45:34 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cfscores.c,v 1.21 2010/01/03 17:08:45 dholland Exp $   */
+/*     $NetBSD: cfscores.c,v 1.22 2014/03/22 23:45:34 dholland Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: cfscores.c,v 1.21 2010/01/03 17:08:45 dholland Exp $");
+__RCSID("$NetBSD: cfscores.c,v 1.22 2014/03/22 23:45:34 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -106,7 +106,7 @@
 {
        struct betinfo total;
        off_t pos;
-       int i;
+       ssize_t i;
 
        pos = pw->pw_uid * (off_t)sizeof(struct betinfo);
        /* test pos, not pw_uid; uid_t can be unsigned, which makes gcc warn */
@@ -114,9 +114,9 @@
                warnx("Bad uid %d", (int)pw->pw_uid);
                return;
        }
-       i = lseek(dbfd, pos, SEEK_SET);
-       if (i < 0)
-               warn("lseek %s", _PATH_SCORE);
+       if (lseek(dbfd, pos, SEEK_SET) < 0) {
+               warn("%s: lseek", _PATH_SCORE);
+       }
        i = read(dbfd, &total, sizeof(total));
        if (i < 0)
                warn("read %s", _PATH_SCORE);



Home | Main Index | Thread Index | Old Index