$OpenBSD: patch-src_main_platform_c,v 1.5 2012/10/29 11:07:29 dcoppa Exp $

Allow building with USE_SYSTRACE=Yes

--- src/main/platform.c.orig	Thu Aug 16 00:05:05 2012
+++ src/main/platform.c	Fri Oct 26 10:10:18 2012
@@ -2196,18 +2196,24 @@ SEXP attribute_hidden do_dircreate(SEXP call, SEXP op,
 	    res = mkdir(dir, (mode_t) mode);
 	    /* Solaris 10 returns ENOSYS on automount, PR#13834
 	       EROFS is allowed by POSIX, so we skip that too */
+	    /* EPERM added for systrace builds */
 	    serrno = errno;
-	    if (res && serrno != EEXIST && serrno != ENOSYS && serrno != EROFS) 
+	    if (res && serrno != EEXIST && serrno != ENOSYS &&
+		serrno != EROFS && serrno != EPERM)
 		goto end;
 	    *p = '/';
 	}
     }
     res = mkdir(dir, (mode_t) mode);
     serrno = errno;
-    if (show && res && serrno == EEXIST)
-	warning(_("'%s' already exists"), dir);
+    if (show && res) {
+	if (serrno == EEXIST)
+	    warning(_("'%s' already exists"), dir);
+	if (serrno == EPERM)
+	    warning(_("'%s' permissions problem"), dir);
+    }
 end:
-    if (show && res && serrno != EEXIST)
+    if (show && res && serrno != EEXIST && serrno != EPERM)
 	warning(_("cannot create dir '%s', reason '%s'"), dir,
 		strerror(serrno));
     return ScalarLogical(res == 0);
