$OpenBSD: patch-lib_fileutils_rb,v 1.1.1.1 2020/12/28 16:45:27 jeremy Exp $

Make FileUtils.mkdir_p act more like mkdir(1) -p, by not attempting
to create directories that already exist.  This fixes systrace
warnings when building ports.

Index: lib/fileutils.rb
--- lib/fileutils.rb.orig
+++ lib/fileutils.rb
@@ -213,7 +213,7 @@ module FileUtils
 
       # optimize for the most common case
       begin
-        fu_mkdir path, mode
+        fu_mkdir path, mode unless File.directory?(path)
         next
       rescue SystemCallError
         next if File.directory?(path)
@@ -228,7 +228,7 @@ module FileUtils
       stack.pop if path == stack.last   # root directory should exist
       stack.reverse_each do |dir|
         begin
-          fu_mkdir dir, mode
+          fu_mkdir dir, mode unless File.directory?(dir)
         rescue SystemCallError
           raise unless File.directory?(dir)
         end
