$OpenBSD: patch-src_tools_wasm-strip_cc,v 1.1 2021/05/13 05:00:36 semarie Exp $

Index: src/tools/wasm-strip.cc
--- src/tools/wasm-strip.cc.orig
+++ src/tools/wasm-strip.cc
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+#include <err.h>
+#include <unistd.h>
+
 #include "src/binary.h"
 #include "src/binary-reader.h"
 #include "src/binary-reader-nop.h"
@@ -85,6 +88,11 @@ int ProgramMain(int argc, char** argv) {
   InitStdio();
   ParseOptions(argc, argv);
 
+  if (unveil(s_filename.c_str(), "rwc") != 0)
+    err(1, "unveil: %s", s_filename.c_str());
+  if (pledge("stdio rpath wpath cpath", NULL) != 0)
+    err(1, "pledge");
+  
   std::vector<uint8_t> file_data;
   result = ReadFile(s_filename.c_str(), &file_data);
   if (Succeeded(result)) {
