Hi, first try to add pledge(2) support to misc/memcached (only slightly tested), if I try to put the pledge(2) call before the process dies with syscall 105. Is this acceptable or should I try to move the pledge(2) code above (before event_init(3) ) ? Thanks & Cheers Giovanni
Index: Makefile =================================================================== RCS file: /cvs/ports/misc/memcached/Makefile,v retrieving revision 1.30 diff -u -p -r1.30 Makefile --- Makefile 5 Mar 2016 21:30:16 -0000 1.30 +++ Makefile 5 Mar 2016 22:24:50 -0000 @@ -3,6 +3,7 @@ COMMENT= distributed memory object caching system DISTNAME= memcached-1.4.25 +REVISION= 0 CATEGORIES= misc HOMEPAGE= http://www.memcached.org/ Index: patches/patch-configure =================================================================== RCS file: /cvs/ports/misc/memcached/patches/patch-configure,v retrieving revision 1.7 diff -u -p -r1.7 patch-configure --- patches/patch-configure 5 May 2015 15:43:03 -0000 1.7 +++ patches/patch-configure 5 Mar 2016 22:24:50 -0000 @@ -1,7 +1,7 @@ $OpenBSD: patch-configure,v 1.7 2015/05/05 15:43:03 giovanni Exp $ ---- configure.orig Sat Apr 25 22:53:45 2015 -+++ configure Mon May 4 13:05:07 2015 -@@ -6435,7 +6435,7 @@ $as_echo "#define _GNU_SOURCE 1" >>confdefs.h +--- configure.orig Fri Nov 20 08:02:49 2015 ++++ configure Sat Mar 5 22:20:56 2016 +@@ -6390,7 +6390,7 @@ $as_echo "#define _GNU_SOURCE 1" >>confdefs.h elif test "$GCC" = "yes" then GCC_VERSION=`$CC -dumpversion` Index: patches/patch-items_c =================================================================== RCS file: /cvs/ports/misc/memcached/patches/patch-items_c,v retrieving revision 1.10 diff -u -p -r1.10 patch-items_c --- patches/patch-items_c 5 May 2015 15:43:03 -0000 1.10 +++ patches/patch-items_c 5 Mar 2016 22:24:50 -0000 @@ -2,9 +2,9 @@ $OpenBSD: patch-items_c,v 1.10 2015/05/0 printf format string fix for long long time_t ---- items.c.orig Sat Apr 25 22:47:33 2015 -+++ items.c Mon May 4 12:52:52 2015 -@@ -459,9 +459,9 @@ char *item_cachedump(const unsigned int slabs_clsid, c +--- items.c.orig Fri Nov 20 02:18:56 2015 ++++ items.c Sat Mar 5 22:20:56 2016 +@@ -460,9 +460,9 @@ char *item_cachedump(const unsigned int slabs_clsid, c /* Copy the key since it may not be null-terminated in the struct */ strncpy(key_temp, ITEM_key(it), it->nkey); key_temp[it->nkey] = 0x00; /* terminate */ Index: patches/patch-memcached_c =================================================================== RCS file: patches/patch-memcached_c diff -N patches/patch-memcached_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-memcached_c 5 Mar 2016 22:24:50 -0000 @@ -0,0 +1,30 @@ +$OpenBSD$ +--- memcached.c.orig Thu Nov 19 08:19:56 2015 ++++ memcached.c Sat Mar 5 23:09:10 2016 +@@ -23,6 +23,7 @@ + #include <sys/uio.h> + #include <ctype.h> + #include <stdarg.h> ++#include <unistd.h> + + /* some POSIX systems need the following definition + * to get mlockall flags out of sys/mman.h. */ +@@ -5766,6 +5767,18 @@ int main (int argc, char **argv) { + + if (pid_file != NULL) { + save_pid(pid_file); ++ } ++ ++ if (settings.socketpath != NULL) { ++ if (pledge("stdio rpath unix proc", NULL) == -1) { ++ fprintf(stderr, "%s: pledge: %s\n", argv[0], strerror(errno)); ++ exit(1); ++ } ++ } else { ++ if (pledge("stdio rpath inet proc", NULL) == -1) { ++ fprintf(stderr, "%s: pledge: %s\n", argv[0], strerror(errno)); ++ exit(1); ++ } + } + + /* Drop privileges no longer needed */