summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-29 23:00:10 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-29 23:00:10 +0000
commit48adb27998c1144d802791e25c55bed63e44d7f1 (patch)
tree35c1aab77ceac8a2dad5fdada422107874cb8e04
parentdb4ff0537a285137d22d610a8d229d30955181f3 (diff)
use names for constants in lseek() and open(); NetBSD PR6057; jsm28@cam.ac.uk
-rw-r--r--games/canfield/canfield/canfield.c14
-rw-r--r--games/canfield/cfscores/cfscores.c7
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 <sys/types.h>
-#include <curses.h>
-#include <termios.h>
#include <ctype.h>
+#include <curses.h>
+#include <fcntl.h>
#include <signal.h>
+#include <stdlib.h>
#include <string.h>
#include <termios.h>
+#include <unistd.h>
#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 <sys/types.h>
+#include <fcntl.h>
#include <pwd.h>
+#include <stdio.h>
+#include <unistd.h>
#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;