diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2015-11-24 16:54:23 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2015-11-24 16:54:23 +0000 |
commit | 0acdbc67a3ded82bf510f4bf399ae31ae655fcbf (patch) | |
tree | b25023caef9fbbca95ba247293d934b580a5f7f9 | |
parent | 96b33884ee111dbe0eb13560ca86daabb27f5b57 (diff) |
repair lseeks, from Ricardo
-rw-r--r-- | games/canfield/canfield/canfield.c | 12 | ||||
-rw-r--r-- | games/canfield/cfscores/cfscores.c | 7 |
2 files changed, 4 insertions, 15 deletions
diff --git a/games/canfield/canfield/canfield.c b/games/canfield/canfield/canfield.c index b9f1a814451..34c8ae9306e 100644 --- a/games/canfield/canfield/canfield.c +++ b/games/canfield/canfield/canfield.c @@ -1,4 +1,4 @@ -/* $OpenBSD: canfield.c,v 1.17 2015/11/24 02:53:39 tedu Exp $ */ +/* $OpenBSD: canfield.c,v 1.18 2015/11/24 16:54:22 tedu Exp $ */ /* $NetBSD: canfield.c,v 1.7 1995/05/13 07:28:35 jtc Exp $ */ /* @@ -1377,7 +1377,7 @@ suspend(void) move(21, 0); refresh(); if (dbfd != -1) { - lseek(dbfd, sizeof(struct betinfo), SEEK_SET); + lseek(dbfd, 0, SEEK_SET); write(dbfd, (char *)&total, sizeof(total)); } kill(getpid(), SIGTSTP); @@ -1635,12 +1635,6 @@ initall(void) dbfd = open(scorepath, O_RDWR | O_CREAT, 0644); if (dbfd < 0) return; - i = lseek(dbfd, sizeof(struct betinfo), SEEK_SET); - if (i < 0) { - close(dbfd); - dbfd = -1; - return; - } i = read(dbfd, (char *)&total, sizeof(total)); if (i < 0) { close(dbfd); @@ -1698,7 +1692,7 @@ cleanup(int dummy) status = NOBOX; updatebettinginfo(); if (dbfd != -1) { - lseek(dbfd, sizeof(struct betinfo), SEEK_SET); + lseek(dbfd, 0, 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 39cfb5d5b1d..e91327a996b 100644 --- a/games/canfield/cfscores/cfscores.c +++ b/games/canfield/cfscores/cfscores.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfscores.c,v 1.17 2015/11/24 02:53:39 tedu Exp $ */ +/* $OpenBSD: cfscores.c,v 1.18 2015/11/24 16:54:22 tedu Exp $ */ /* $NetBSD: cfscores.c,v 1.3 1995/03/21 15:08:37 cgd Exp $ */ /* @@ -91,11 +91,6 @@ printuser(const struct passwd *pw, int printfail) printf("Bad uid %u\n", pw->pw_uid); return; } - i = lseek(dbfd, sizeof(struct betinfo), SEEK_SET); - if (i < 0) { - warn("lseek %s", scorepath); - return; - } i = read(dbfd, (char *)&total, sizeof(total)); if (i < 0) { warn("lseek %s", scorepath); |