chiark / gitweb /
nailing-cargo: Break out same_file
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 May 2020 23:26:56 +0000 (00:26 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 May 2020 23:26:56 +0000 (00:26 +0100)
No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
nailing-cargo

index 4a8daf99ccd16f63a37967861c9d343f83ea2b67..737c274d53a0383285c08fd2afb910bad6ce04bf 100755 (executable)
@@ -142,6 +142,11 @@ sub getcfg ($$) {
 
 sub unlink_or_enoent ($) { unlink $_[0] or $!==ENOENT; }
 
+sub same_file ($$) {
+  my ($x,$y) = @_;
+  "@$x[0..5]" eq "@$y[0..5]";
+}
+
 sub takelock () {
   for (;;) {
     open LOCK, ">", $lockfile or die "$self: open/create $lockfile: $!\n";
@@ -152,7 +157,7 @@ sub takelock () {
       next if $! == ENOENT;
       die "$self: stat $lockfile: $!\n";
     }
-    last if "@fstat[0..5]" eq "@stat[0..5]";
+    last if same_file(\@fstat,\@stat);
   }
 }
 sub unlock () {