]> git.openstreetmap.org Git - chef.git/commitdiff
Simplify fdirsync and avoid race closing the descriptor
authorTom Hughes <tom@compton.nu>
Thu, 28 Sep 2023 17:28:27 +0000 (18:28 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 28 Sep 2023 17:28:49 +0000 (18:28 +0100)
cookbooks/planet/files/default/replication-bin/replicate-changesets

index 5d47266e62ba3eac96d9e99ac0a7a8d257d8c7d1..92b5408d79819cf6febf05864aaae8b0ef4cf0e6 100755 (executable)
@@ -128,10 +128,7 @@ end
 # to guarantee sync for newly created directories.
 def fdirsync(d)
   while d != "/"
-    Dir.open(d) do |dh|
-      io = IO.for_fd(dh.fileno)
-      io.fsync
-    end
+    fsync(d)
     d = File.dirname(d)
   end
 end