Avoid dereferencing $ENV{HOME} if it is undefined (#32)
Avoid dereferencing $ENV{HOME} if it is undefined
This commit is contained in:
commit
5f875009f8
1 changed files with 5 additions and 1 deletions
|
@ -662,7 +662,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) {
|
||||
open my $FILE, '<', $file
|
||||
or die "Could not open $file for reading\n";
|
||||
|
|
Loading…
Reference in a new issue