summaryrefslogtreecommitdiffstats
path: root/tetris
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2014-03-22 19:05:30 +0000
committerdholland <dholland@NetBSD.org>2014-03-22 19:05:30 +0000
commit6043453f183665643a49a2c35f525d3fb5fba2f5 (patch)
tree6258f0dc1c3b9791377b078174eb88829e7ca49b /tetris
parenta8777374397a2b8c881b5aedddb1125e1263fb0d (diff)
downloadbsdgames-darwin-6043453f183665643a49a2c35f525d3fb5fba2f5.tar.gz
bsdgames-darwin-6043453f183665643a49a2c35f525d3fb5fba2f5.tar.zst
bsdgames-darwin-6043453f183665643a49a2c35f525d3fb5fba2f5.zip
Revert part of previous -r1.21 and fix the errno-handling bug instead.
Diffstat (limited to 'tetris')
-rw-r--r--tetris/scores.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tetris/scores.c b/tetris/scores.c
index 83cc6f24..2157e8bd 100644
--- a/tetris/scores.c
+++ b/tetris/scores.c
@@ -1,4 +1,4 @@
-/* $NetBSD: scores.c,v 1.21 2013/10/19 17:23:08 christos Exp $ */
+/* $NetBSD: scores.c,v 1.22 2014/03/22 19:05:30 dholland Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -383,6 +383,7 @@ getscores(int *fdp)
mode_t mask;
const char *human;
int doflip;
+ int serrno;
ssize_t result;
#ifdef ALLOW_SCORE_UPDATES
@@ -400,6 +401,7 @@ getscores(int *fdp)
setegid(egid);
mask = umask(S_IWOTH);
sd = open(_PATH_SCOREFILE, mint, 0666);
+ serrno = errno;
(void)umask(mask);
setegid(gid);
if (sd < 0) {
@@ -410,6 +412,7 @@ getscores(int *fdp)
* trying to write it, don't fail -- we can still show
* the player the score they got.
*/
+ errno = serrno;
if (fdp != NULL || errno != ENOENT) {
warn("Cannot open %s for %s", _PATH_SCOREFILE, human);
}