53 lines
2.0 KiB
Diff
53 lines
2.0 KiB
Diff
From 3f00c73f8b4b57bb965ae618f30684421d55f01e Mon Sep 17 00:00:00 2001
|
|
From: John <johnz@posteo.net>
|
|
Date: Fri, 29 Nov 2019 10:35:44 +0100
|
|
Subject: [PATCH 1/3] Check for group_member in cmake
|
|
|
|
instead of trying to use it on all non Apple Unix systems
|
|
E.g. the musl libc on Linux also does not provide this function since it
|
|
is a nonstandard GNU extension
|
|
---
|
|
src/cpp/core/CMakeLists.txt | 1 +
|
|
src/cpp/core/config.h.in | 1 +
|
|
src/cpp/core/r_util/RSessionContext.cpp | 2 +-
|
|
3 files changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git src/cpp/core/CMakeLists.txt src/cpp/core/CMakeLists.txt
|
|
index 7395ff24ee..8cd1080ae8 100644
|
|
--- a/src/cpp/core/CMakeLists.txt
|
|
+++ b/src/cpp/core/CMakeLists.txt
|
|
@@ -155,6 +155,7 @@ if (UNIX)
|
|
check_function_exists(inotify_init1 HAVE_INOTIFY_INIT1)
|
|
check_function_exists(getpeereid HAVE_GETPEEREID)
|
|
check_function_exists(setresuid HAVE_SETRESUID)
|
|
+ check_function_exists(group_member HAVE_GROUP_MEMBER)
|
|
if(EXISTS "/proc/self")
|
|
set(HAVE_PROCSELF TRUE)
|
|
endif()
|
|
diff --git src/cpp/core/config.h.in src/cpp/core/config.h.in
|
|
index fbf5e6ffa3..cb4ef42be0 100644
|
|
--- a/src/cpp/core/config.h.in
|
|
+++ b/src/cpp/core/config.h.in
|
|
@@ -24,4 +24,5 @@
|
|
#cmakedefine HAVE_PROCSELF
|
|
#cmakedefine HAVE_SETRESUID
|
|
#cmakedefine HAVE_SCANDIR_POSIX
|
|
+#cmakedefine HAVE_GROUP_MEMBER
|
|
#cmakedefine RSTUDIO_SERVER
|
|
diff --git src/cpp/core/r_util/RSessionContext.cpp src/cpp/core/r_util/RSessionContext.cpp
|
|
index a973b8b816..e36d661fd8 100644
|
|
--- a/src/cpp/core/r_util/RSessionContext.cpp
|
|
+++ b/src/cpp/core/r_util/RSessionContext.cpp
|
|
@@ -182,7 +182,7 @@ bool isSharedPath(const std::string& projectPath,
|
|
if (st.st_gid == user.getGroupId())
|
|
return false;
|
|
|
|
-#ifndef __APPLE__
|
|
+#ifdef HAVE_GROUP_MEMBER
|
|
// not shared if we're in any of the groups that own the directory
|
|
// (note that this checks supplementary group IDs only, so the check
|
|
// against the primary group ID above is still required)
|
|
--
|
|
2.24.0
|
|
|