$OpenBSD: patch-Source_kwsys_SystemTools_cxx,v 1.26 2020/12/30 07:17:34 rsadowski Exp $

Don't spam systrace by attempting to create dirs which already exist

Index: Source/kwsys/SystemTools.cxx
--- Source/kwsys/SystemTools.cxx.orig
+++ Source/kwsys/SystemTools.cxx
@@ -277,12 +277,14 @@ inline void Realpath(const std::string& path, std::str
 }
 #else
 #  include <sys/types.h>
+#  include <sys/stat.h>
 
 #  include <fcntl.h>
 #  include <unistd.h>
 inline int Mkdir(const std::string& dir, const mode_t* mode)
 {
-  return mkdir(dir.c_str(), mode ? *mode : 00777);
+  struct stat sb;
+  return stat(dir.c_str(), &sb) && mkdir(dir.c_str(), 00777);
 }
 inline int Rmdir(const std::string& dir)
 {
