From 8426350c1b01f9f225c0a9a5617dba65936cf6c8 Mon Sep 17 00:00:00 2001 From: hubertf Date: Mon, 25 Jul 2005 13:13:00 +0000 Subject: Pull over change from src/usr.sbin/pkg_install: | Modified Files: | src/usr.sbin/pkg_install/add: perform.c | | Log Message: | cleanup: preserve errno. Needed so err() functions ran after running | cleanup(0) print the correct error message. | | | To generate a diff of this commit: | cvs rdiff -r1.109 -r1.110 src/usr.sbin/pkg_install/add/perform.c --- pkgtools/pkg_install/files/add/perform.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'pkgtools') diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c index 10613adddfb..fa57c4ffb40 100644 --- a/pkgtools/pkg_install/files/add/perform.c +++ b/pkgtools/pkg_install/files/add/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.32 2005/07/18 09:14:04 hubertf Exp $ */ +/* $NetBSD: perform.c,v 1.33 2005/07/25 13:13:00 hubertf Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp"; #else -__RCSID("$NetBSD: perform.c,v 1.32 2005/07/18 09:14:04 hubertf Exp $"); +__RCSID("$NetBSD: perform.c,v 1.33 2005/07/25 13:13:00 hubertf Exp $"); #endif #endif @@ -41,6 +41,9 @@ __RCSID("$NetBSD: perform.c,v 1.32 2005/07/18 09:14:04 hubertf Exp $"); #if HAVE_ERR_H #include #endif +#if HAVE_ERRNO_H +#include +#endif #include "lib.h" #include "add.h" #include "verify.h" @@ -1013,8 +1016,11 @@ void cleanup(int signo) { static int alreadyCleaning; - void (*oldint) (int); - void (*oldhup) (int); + void (*oldint) (int); + void (*oldhup) (int); + int saved_errno; + + saved_errno = errno; oldint = signal(SIGINT, SIG_IGN); oldhup = signal(SIGHUP, SIG_IGN); @@ -1030,6 +1036,7 @@ cleanup(int signo) } signal(SIGINT, oldint); signal(SIGHUP, oldhup); + errno = saved_errno; } int -- cgit v1.2.3