1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

repair lseeks, from Ricardo

This commit is contained in:
tedu 2015-11-24 16:54:22 +00:00
parent 863860e5c2
commit e10665cf08
2 changed files with 4 additions and 15 deletions

View File

@ -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);
}

View File

@ -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);