avoid creating a core with fullhostname for localhost, preventing some
unpleasant aliasing effects
This commit is contained in:
parent
e2f83b2f10
commit
36514ef156
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Core.pm,v 1.44 2013/09/18 15:30:40 espie Exp $
|
||||
# $OpenBSD: Core.pm,v 1.45 2013/09/21 08:40:09 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -31,13 +31,14 @@ sub shell
|
||||
sub new
|
||||
{
|
||||
my ($class, $name, $prop) = @_;
|
||||
if ($class->name_is_localhost($name)) {
|
||||
$class = "DPB::Host::Localhost";
|
||||
$name = 'localhost';
|
||||
} else {
|
||||
require DPB::Core::Distant;
|
||||
$class = "DPB::Host::Distant";
|
||||
}
|
||||
if (!defined $hosts->{$name}) {
|
||||
if ($class->name_is_localhost($name)) {
|
||||
$class = "DPB::Host::Localhost";
|
||||
} else {
|
||||
require DPB::Core::Distant;
|
||||
$class = "DPB::Host::Distant";
|
||||
}
|
||||
my $h = bless {host => $name,
|
||||
prop => DPB::HostProperties->finalize($prop) }, $class;
|
||||
# XXX have to register *before* creating the shell
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Init.pm,v 1.2 2013/09/08 11:10:59 espie Exp $
|
||||
# $OpenBSD: Init.pm,v 1.3 2013/09/21 08:40:09 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -81,11 +81,9 @@ sub new
|
||||
{
|
||||
my ($class, $host, $prop) = @_;
|
||||
if (DPB::Host->name_is_localhost($host)) {
|
||||
return $init->{localhost} //= DPB::Core::Local->new_noreg($host, $prop);
|
||||
} else {
|
||||
require DPB::Core::Distant;
|
||||
return $init->{$host} //= DPB::Core::Distant->new_noreg($host, $prop);
|
||||
$host = 'localhost';
|
||||
}
|
||||
return $init->{$host} //= DPB::Core->new_noreg($host, $prop);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user