-/* $NetBSD: cfscores.c,v 1.13 2005/07/01 16:50:55 jmc Exp $ */
+/* $NetBSD: cfscores.c,v 1.15 2008/07/20 01:03:21 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
#include <sys/cdefs.h>
#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n");
+__COPYRIGHT("@(#) Copyright (c) 1983, 1993\
+ The Regents of the University of California. All rights reserved.");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: cfscores.c,v 1.13 2005/07/01 16:50:55 jmc Exp $");
+__RCSID("$NetBSD: cfscores.c,v 1.15 2008/07/20 01:03:21 lukem Exp $");
#endif
#endif /* not lint */
main(int argc, char *argv[])
{
struct passwd *pw;
- int uid;
+ uid_t uid;
/* Revoke setgid privileges */
setgid(getgid());
printuser(const struct passwd *pw, int printfail)
{
struct betinfo total;
+ off_t pos;
int i;
- if (pw->pw_uid < 0) {
- printf("Bad uid %d\n", pw->pw_uid);
+ pos = pw->pw_uid * (off_t)sizeof(struct betinfo);
+ /* test pos, not pw_uid; uid_t can be unsigned, which makes gcc warn */
+ if (pos < 0) {
+ printf("Bad uid %d\n", (int)pw->pw_uid);
return;
}
- i = lseek(dbfd, pw->pw_uid * sizeof(struct betinfo), SEEK_SET);
+ i = lseek(dbfd, pos, SEEK_SET);
if (i < 0)
warn("lseek %s", _PATH_SCORE);
i = read(dbfd, (char *)&total, sizeof(total));