Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/5ddd5eb000ff
branches:  trunk
changeset: 535423:5ddd5eb000ff
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sun Aug 18 08:03:35 2002 +0000

description:
save/restore errno in signal handlers.

diffstat:

 sbin/dump/optr.c |  7 +++++--
 sbin/dump/tape.c |  7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs (70 lines):

diff -r 7683e994b261 -r 5ddd5eb000ff sbin/dump/optr.c
--- a/sbin/dump/optr.c  Sun Aug 18 07:45:04 2002 +0000
+++ b/sbin/dump/optr.c  Sun Aug 18 08:03:35 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: optr.c,v 1.27 2002/08/16 20:21:49 itojun Exp $ */
+/*     $NetBSD: optr.c,v 1.28 2002/08/18 08:03:35 yamt Exp $   */
 
 /*-
  * Copyright (c) 1980, 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)optr.c     8.2 (Berkeley) 1/6/94";
 #else
-__RCSID("$NetBSD: optr.c,v 1.27 2002/08/16 20:21:49 itojun Exp $");
+__RCSID("$NetBSD: optr.c,v 1.28 2002/08/18 08:03:35 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -177,10 +177,13 @@
 void
 interrupt(int signo)
 {
+       int errno_save;
 
+       errno_save = errno;
        msg("Interrupt received.\n");
        if (query("Do you want to abort dump?"))
                dumpabort(0);
+       errno = errno_save;
 }
 
 /*
diff -r 7683e994b261 -r 5ddd5eb000ff sbin/dump/tape.c
--- a/sbin/dump/tape.c  Sun Aug 18 07:45:04 2002 +0000
+++ b/sbin/dump/tape.c  Sun Aug 18 08:03:35 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tape.c,v 1.37 2002/01/07 17:34:09 bouyer Exp $ */
+/*     $NetBSD: tape.c,v 1.38 2002/08/18 08:03:35 yamt Exp $   */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)tape.c     8.4 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: tape.c,v 1.37 2002/01/07 17:34:09 bouyer Exp $");
+__RCSID("$NetBSD: tape.c,v 1.38 2002/08/18 08:03:35 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -265,9 +265,11 @@
 {
        time_t  tnow, deltat;
        char    msgbuf[128];
+       int     errno_save;
 
        if (blockswritten < 500)
                return;
+       errno_save = errno;
        (void) time((time_t *) &tnow);
        if (tnow <= tstart_volume)
                return;
@@ -280,6 +282,7 @@
              (tnow - tstart_volume)),
            (int)(deltat / 3600), (int)((deltat % 3600) / 60));
        write(STDERR_FILENO, msgbuf, strlen(msgbuf));
+       errno = errno_save;
 }
 
 static void



Home | Main Index | Thread Index | Old Index