git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-send-email.perl: ensure $domain is defined before using it
@ 2010-09-27  3:18 Brandon Casey
  2010-09-27 22:19 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Brandon Casey @ 2010-09-27  3:18 UTC (permalink / raw)
  To: gitster; +Cc: git, brian, Brandon Casey

valid_fqdn() may attempt to operate on an undefined value if
Net::Domain::domainname fails to determine the domain name.  This causes
perl to emit unpleasant warnings.

So, add a check for whether $domain has been defined before using it.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 git-send-email.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 6dab3bf..e1f29a7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -895,7 +895,7 @@ sub sanitize_address {
 
 sub valid_fqdn {
 	my $domain = shift;
-	return !($^O eq 'darwin' && $domain =~ /\.local$/) && $domain =~ /\./;
+	return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/) && $domain =~ /\./;
 }
 
 sub maildomain_net {
-- 
1.7.3.1.geb284

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-send-email.perl: ensure $domain is defined before using it
  2010-09-27  3:18 [PATCH] git-send-email.perl: ensure $domain is defined before using it Brandon Casey
@ 2010-09-27 22:19 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2010-09-27 22:19 UTC (permalink / raw)
  To: Brandon Casey; +Cc: git, brian

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-27 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-27  3:18 [PATCH] git-send-email.perl: ensure $domain is defined before using it Brandon Casey
2010-09-27 22:19 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).