From d752aeb38d80a8342ba88c5fe5483be61b987182 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 21 Oct 2007 20:02:18 -0400 Subject: [PATCH 1/1] getcwd might fail if the working directory is deleted. deal with it. --- mr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mr b/mr index d9cde93..59d6a69 100755 --- a/mr +++ b/mr @@ -286,7 +286,6 @@ $SIG{INT}=sub { $ENV{MR_CONFIG}="$ENV{HOME}/.mrconfig"; my $config_overridden=0; -my $directory=getcwd(); my $verbose=0; my $stats=0; my $no_recurse=0; @@ -295,6 +294,7 @@ my %config; my %configfiles; my %knownactions; my %alias; +my $directory=getcwd(); Getopt::Long::Configure("no_permute"); my $result=GetOptions( @@ -310,6 +310,9 @@ if (! $result || @ARGV < 1) { "(Use mr help for man page.)\n"); } +if (! defined $directory) { + die("mr: failed to determine working directory\n"); +} # Make sure MR_CONFIG is an absolute path, but don't use abs_path since # the config file might be a symlink to elsewhere, and the directory it's -- 2.39.5