From b42cb89fddf34882faabb7d6abcac256308faca1 Mon Sep 17 00:00:00 2001 From: Will Aoki Date: Wed, 3 Apr 2019 09:48:15 -0600 Subject: [PATCH] Avoid dereferencing $ENV{HOME} if it is undefined --- bin/stow.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/stow.in b/bin/stow.in index 98b576e..367657a 100755 --- a/bin/stow.in +++ b/bin/stow.in @@ -598,7 +598,11 @@ sub check_packages { #============================================================================= sub get_config_file_options { my @defaults = (); - for my $file ("$ENV{HOME}/.stowrc", '.stowrc') { + my @dirlist = ('.stowrc'); + if (defined($ENV{HOME})) { + unshift(@dirlist, "$ENV{HOME}/.stowrc"); + } + for my $file (@dirlist) { if (-r $file) { warn "Loading defaults from $file\n"; open my $FILE, '<', $file