Source-Changes-HG archive

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

[src/trunk]: src/sbin/fsck_ffs save and restore errno in signal handlers.



details:   https://anonhg.NetBSD.org/src/rev/dfc16124f617
branches:  trunk
changeset: 545651:dfc16124f617
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sun Apr 13 10:22:40 2003 +0000

description:
save and restore errno in signal handlers.

diffstat:

 sbin/fsck_ffs/utilities.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r ff0665c815db -r dfc16124f617 sbin/fsck_ffs/utilities.c
--- a/sbin/fsck_ffs/utilities.c Sun Apr 13 09:54:41 2003 +0000
+++ b/sbin/fsck_ffs/utilities.c Sun Apr 13 10:22:40 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: utilities.c,v 1.37 2003/04/06 17:23:26 fvdl Exp $      */
+/*     $NetBSD: utilities.c,v 1.38 2003/04/13 10:22:40 yamt Exp $      */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)utilities.c        8.6 (Berkeley) 5/19/95";
 #else
-__RCSID("$NetBSD: utilities.c,v 1.37 2003/04/06 17:23:26 fvdl Exp $");
+__RCSID("$NetBSD: utilities.c,v 1.38 2003/04/13 10:22:40 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -53,6 +53,7 @@
 
 #include <ctype.h>
 #include <err.h>
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -548,9 +549,12 @@
 catchquit(sig)
        int sig;
 {
+       int errsave = errno;
+
        printf("returning to single-user after file system check\n");
        returntosingle = 1;
        (void)signal(SIGQUIT, SIG_DFL);
+       errno = errsave;
 }
 
 /*
@@ -561,10 +565,12 @@
 voidquit(sig)
        int sig;
 {
+       int errsave = errno;
 
        sleep(1);
        (void)signal(SIGQUIT, SIG_IGN);
        (void)signal(SIGQUIT, SIG_DFL);
+       errno = errsave;
 }
 
 /*



Home | Main Index | Thread Index | Old Index