Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2022-09-18 17:08:31 +0300
committerSimon Tatham <anakin@pobox.com>2022-09-18 17:08:31 +0300
commitfda41e199093b41f026fb8c06e8e2cddcace4d83 (patch)
treee6ed84ca7b9e7644c66b2991d08ffaeaa1029742
parent732ec31a17a7feac9c24c427f79734e9a97b922f (diff)
Add cmake check for whether setpgrp takes arguments.
FreeBSD declares setpgrp() as taking two arguments, like Linux's setpgid(). Detect that at configure time and adjust the call in Pageant appropriately.
-rw-r--r--cmake/cmake.h.in2
-rw-r--r--cmake/platforms/unix.cmake15
-rw-r--r--unix/pageant.c4
3 files changed, 21 insertions, 0 deletions
diff --git a/cmake/cmake.h.in b/cmake/cmake.h.in
index 4ce869f4..91d52d78 100644
--- a/cmake/cmake.h.in
+++ b/cmake/cmake.h.in
@@ -43,6 +43,8 @@
#cmakedefine01 HAVE_CLOCK_MONOTONIC
#cmakedefine01 HAVE_CLOCK_GETTIME
#cmakedefine01 HAVE_SO_PEERCRED
+#cmakedefine01 HAVE_NULLARY_SETPGRP
+#cmakedefine01 HAVE_BINARY_SETPGRP
#cmakedefine01 HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
#cmakedefine01 HAVE_PANGO_FONT_MAP_LIST_FAMILIES
diff --git a/cmake/platforms/unix.cmake b/cmake/platforms/unix.cmake
index 04db8129..98474485 100644
--- a/cmake/platforms/unix.cmake
+++ b/cmake/platforms/unix.cmake
@@ -51,6 +51,21 @@ int main(int argc, char **argv) {
cr.pid + cr.uid + cr.gid;
}" HAVE_SO_PEERCRED)
+check_c_source_compiles("
+#include <sys/types.h>
+#include <unistd.h>
+
+int main(int argc, char **argv) {
+ setpgrp();
+}" HAVE_NULLARY_SETPGRP)
+check_c_source_compiles("
+#include <sys/types.h>
+#include <unistd.h>
+
+int main(int argc, char **argv) {
+ setpgrp(0, 0);
+}" HAVE_BINARY_SETPGRP)
+
if(HAVE_GETADDRINFO AND PUTTY_IPV6)
set(NO_IPV6 OFF)
else()
diff --git a/unix/pageant.c b/unix/pageant.c
index cef57b5b..6d125fce 100644
--- a/unix/pageant.c
+++ b/unix/pageant.c
@@ -330,7 +330,11 @@ void pageant_fork_and_print_env(bool retain_tty)
/* Get out of our previous process group, to avoid being
* blasted by passing signals. But keep our controlling tty,
* so we can keep checking to see if we still have one. */
+#if defined HAVE_NULLARY_SETPGRP
setpgrp();
+#elif defined HAVE_BINARY_SETPGRP
+ setpgrp(0, 0);
+#endif
} else {
/* Do that, but also leave our entire session and detach from
* the controlling tty (if any). */