From 836a10587e3bd24038b2809dfa6277b1428b85ca Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Thu, 4 Feb 2021 19:13:23 +0100 Subject: [PATCH] memcached: add patch to fix error for debug build Took me an annoyingly long time to find a mask that the ndk was happy with. The original mask gives identical permissions as this one (and several other variants I tried). printf("%d\n", ~(S_IRUSR | S_IWUSR)); returns a negative number, and I guess that is the reason the ndk is unhappy. Original error message: restart.c:233:48: error: 'umask' called with invalid mode mode_t oldmask = umask(~(S_IRUSR | S_IWUSR)); ^ /home/builder/.termux-build/_cache/android-r21d-api-24-v3/bin/../sysroot/usr/include/bits/fortify/stat.h:47:5: note: from 'diagnose_if' attribute on 'umask': __clang_error_if(mode & ~0777, "'umask' called with invalid mode") { ^ ~~~~~~~~~~~~ /home/builder/.termux-build/_cache/android-r21d-api-24-v3/bin/../sysroot/usr/include/sys/cdefs.h:134:52: note: expanded from macro '__clang_error_if' ^ 1 error generated. make[2]: *** [Makefile:1060: memcached-restart.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [Makefile:1699: all-recursive] Error 1 --- packages/memcached/restart.c.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 packages/memcached/restart.c.patch diff --git a/packages/memcached/restart.c.patch b/packages/memcached/restart.c.patch new file mode 100644 index 0000000000..1317eba72f --- /dev/null +++ b/packages/memcached/restart.c.patch @@ -0,0 +1,11 @@ +--- ../restart.c.orig 2021-02-04 16:19:28.622976160 +0000 ++++ ./restart.c 2021-02-04 17:49:12.448526739 +0000 +@@ -230,7 +230,7 @@ + + // restrictive permissions for the metadata file. + // TODO: also for the mmap file eh? :P +- mode_t oldmask = umask(~(S_IRUSR | S_IWUSR)); ++ mode_t oldmask = umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + FILE *f = fopen(metafile, "w"); + umask(oldmask); + if (f == NULL) {