git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-send-email.perl: ensure $domain is defined before using it

From
Brandon Casey <drafnel@gmail.com>
Date
Sep 27, 2010, 03:18 UTC
Message-ID
<1285557481-16357-1-git-send-email-drafnel@gmail.com>

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
Next: Junio C Hamano
Message 1 of 2 in “git-send-email.perl: ensure $domain is defined before using it”
  1. git-send-email.perl: ensure $domain is defined before using itBrandon Casey, Sep 27, 2010
  2. Junio C HamanoSep 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.