From 6f085fab67ba07ff38284f9fb865a7eb29346460 Mon Sep 17 00:00:00 2001
From: Thadeu Lima de Souza Cascardo <cascardo@debian.org>
Date: Wed, 20 Jan 2021 13:02:16 -0300
Subject: [PATCH] Do not die when hostname cannot be resolved.
Bug-Debian: https://bugs.debian.org/692311
Forwarded: https://github.com/dap/XML-Stream/pull/26
Bug: https://github.com/dap/XML-Stream/pull/26

In case the local hostname cannot be resolved, use it instead of the
full reverse name, as it would have been done in case the reverse would
not work.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@debian.org>

---
 lib/XML/Stream.pm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/XML/Stream.pm b/lib/XML/Stream.pm
index 410a7c4..4c993e2 100644
--- a/lib/XML/Stream.pm
+++ b/lib/XML/Stream.pm
@@ -205,8 +205,7 @@ sub new
     XML::Stream::Tools::setup_debug($self, %args); 
 
     my $hostname = hostname();
-    my $address = gethostbyname($hostname) ||
-        die("Cannot resolve $hostname: $!");
+    my $address = gethostbyname($hostname) || "";
     my $fullname = gethostbyaddr($address,AF_INET) || $hostname;
 
     $self->debug(1,"new: hostname = ($fullname)");
-- 
2.30.0

