Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/tetris Revert part of previous -r1.21 and fix the errn...



details:   https://anonhg.NetBSD.org/src/rev/f19dc066bfa7
branches:  trunk
changeset: 794708:f19dc066bfa7
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Mar 22 19:05:30 2014 +0000

description:
Revert part of previous -r1.21 and fix the errno-handling bug instead.

diffstat:

 games/tetris/scores.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (33 lines):

diff -r c76c74d5ef95 -r f19dc066bfa7 games/tetris/scores.c
--- a/games/tetris/scores.c     Sat Mar 22 18:58:57 2014 +0000
+++ b/games/tetris/scores.c     Sat Mar 22 19:05:30 2014 +0000
@@ -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 @@
        mode_t mask;
        const char *human;
        int doflip;
+       int serrno;
        ssize_t result;
 
 #ifdef ALLOW_SCORE_UPDATES
@@ -400,6 +401,7 @@
        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 @@
                 * 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);
                }



Home | Main Index | Thread Index | Old Index