diff options
author | 2007-06-23 17:55:12 +0000 | |
---|---|---|
committer | 2007-06-23 17:55:12 +0000 | |
commit | d715fc48c3215ca5c89c12d0c248575874ba004c (patch) | |
tree | 1263d0035b04906aa7b16b603e1d4becae40dc3b | |
parent | net80211 growth means vr(4) goes away for now (diff) | |
download | wireguard-openbsd-d715fc48c3215ca5c89c12d0c248575874ba004c.tar.xz wireguard-openbsd-d715fc48c3215ca5c89c12d0c248575874ba004c.zip |
setup a local sigalarm to send a HUP to the ftp process if it takes longer
than 30 seconds to stop... 30 seconds chosen as a `nice' average value.
Note that this is a `work-around' for some specificities of ftp(1), which
usually doesn't react to SIGINT, but reacts instantly to SIGHUP...
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index 72d7c2dafaa..2f01308ec68 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageRepository.pm,v 1.47 2007/06/16 09:37:31 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.48 2007/06/23 17:55:12 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -113,7 +113,14 @@ sub close { my ($self, $object, $hint) = @_; close($object->{fh}) if defined $object->{fh}; - waitpid($object->{pid2}, 0) if defined $object->{pid2}; + if (defined $object->{pid2}) { + local $SIG{ALRM} = sub { + kill HUP => $object->{pid2}; + }; + alarm(30); + waitpid($object->{pid2}, 0); + alarm(0); + } $self->parse_problems($object->{errors}, $hint) if defined $object->{errors}; undef $object->{errors}; |