From 48adb27998c1144d802791e25c55bed63e44d7f1 Mon Sep 17 00:00:00 2001 From: Paul Janzen Date: Sat, 29 Aug 1998 23:00:10 +0000 Subject: use names for constants in lseek() and open(); NetBSD PR6057; jsm28@cam.ac.uk --- games/canfield/canfield/canfield.c | 14 ++++++++------ games/canfield/cfscores/cfscores.c | 7 +++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/games/canfield/canfield/canfield.c b/games/canfield/canfield/canfield.c index a10317ad375..e8a6d18a0dd 100644 --- a/games/canfield/canfield/canfield.c +++ b/games/canfield/canfield/canfield.c @@ -60,12 +60,14 @@ static char rcsid[] = "$NetBSD: canfield.c,v 1.7 1995/05/13 07:28:35 jtc Exp $"; #include -#include -#include #include +#include +#include #include +#include #include #include +#include #include "pathnames.h" @@ -1330,7 +1332,7 @@ suspend() move(21, 0); refresh(); if (dbfd != -1) { - lseek(dbfd, uid * sizeof(struct betinfo), 0); + lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET); write(dbfd, (char *)&total, sizeof(total)); } kill(getpid(), SIGTSTP); @@ -1580,11 +1582,11 @@ initall() initdeck(deck); if (uid < 0) uid = 0; - dbfd = open(_PATH_SCORE, 2); + dbfd = open(_PATH_SCORE, O_RDWR); setegid(getgid()); if (dbfd < 0) return; - i = lseek(dbfd, uid * sizeof(struct betinfo), 0); + i = lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET); if (i < 0) { close(dbfd); dbfd = -1; @@ -1647,7 +1649,7 @@ cleanup() status = NOBOX; updatebettinginfo(); if (dbfd != -1) { - lseek(dbfd, uid * sizeof(struct betinfo), 0); + lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET); write(dbfd, (char *)&total, sizeof(total)); close(dbfd); } diff --git a/games/canfield/cfscores/cfscores.c b/games/canfield/cfscores/cfscores.c index 4f973265fde..c3f9fe3be89 100644 --- a/games/canfield/cfscores/cfscores.c +++ b/games/canfield/cfscores/cfscores.c @@ -48,7 +48,10 @@ static char rcsid[] = "$NetBSD: cfscores.c,v 1.3 1995/03/21 15:08:37 cgd Exp $"; #endif /* not lint */ #include +#include #include +#include +#include #include "pathnames.h" struct betinfo { @@ -75,7 +78,7 @@ main(argc, argv) printf("Usage: cfscores [user]\n"); exit(1); } - dbfd = open(_PATH_SCORE, 0); + dbfd = open(_PATH_SCORE, O_RDONLY); if (dbfd < 0) { perror(_PATH_SCORE); exit(2); @@ -124,7 +127,7 @@ printuser(pw, printfail) printf("Bad uid %d\n", pw->pw_uid); return; } - i = lseek(dbfd, pw->pw_uid * sizeof(struct betinfo), 0); + i = lseek(dbfd, pw->pw_uid * sizeof(struct betinfo), SEEK_SET); if (i < 0) { perror("lseek"); return; -- cgit v1.2.3