]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: pwd-long: diagnose failure earlier
authorJim Meyering <meyering@redhat.com>
Thu, 1 Sep 2011 13:11:12 +0000 (15:11 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 1 Sep 2011 14:36:23 +0000 (16:36 +0200)
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

index 3a5147d7621cf52712325b4f7c9d3ed5d8a1018e..e318457963e64c45dd8194e0a48e551845461103 100755 (executable)
@@ -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;
     }