From 551cbda0278d7e88c7ba52be0510f42ad2466e48 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 1 Sep 2011 15:11:12 +0200 Subject: [PATCH] tests: pwd-long: diagnose failure earlier Without this change, we'd get use-of-uninit value warnings and harder-to-diagnose failure down the road. * tests/misc/pwd-long (normalize_to_cwd_relative): Diagnose stat failure. This failed on AIX 6.1 and 7.1. Reported by Bruno Haible. --- tests/misc/pwd-long | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/misc/pwd-long b/tests/misc/pwd-long index 3a5147d762..e318457963 100755 --- a/tests/misc/pwd-long +++ b/tests/misc/pwd-long @@ -50,6 +50,8 @@ sub normalize_to_cwd_relative ($$$) and die "$ME: $dir does not contain old CWD\n"; my $dir_prefix = $slash ? substr ($dir, 0, $slash) : '/'; my ($d, $i) = (stat $dir_prefix)[0, 1]; + defined $d && defined $i + or die "$ME: $dir_prefix: stat failed: $!\n"; $d eq $dev && $i eq $ino and return substr $dir, $slash + 1; } -- 2.47.2