]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Ignore deprecation warning for daemon on macOS
authorArne Schwabe <arne@rfc2549.org>
Mon, 5 Oct 2020 09:18:05 +0000 (11:18 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 11 Oct 2020 15:50:23 +0000 (17:50 +0200)
macOS warns that we should posix_spawn instead. However posix_spawn
would require a major redesign of code to daemonise or drop the --daemon
feature on macOS. Ignore the clang warning in order to allow -Werror
compile on macOS.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20201005091805.17260-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21171.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/init.c
src/plugins/down-root/down-root.c

index 580a85500006d5d122848b566e5d94099bbc02a5..034edba07e44301a2709db2a1aacc31c8072232f 100644 (file)
@@ -1238,10 +1238,18 @@ possibly_become_daemon(const struct options *options)
     {
         ASSERT(!options->inetd);
         /* Don't chdir immediately, but the end of the init sequence, if needed */
+
+#if defined(__APPLE__) && defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
         if (daemon(1, options->log) < 0)
         {
             msg(M_ERR, "daemon() failed or unsupported");
         }
+#if defined(__APPLE__) && defined(__clang__)
+#pragma clang diagnostic pop
+#endif
         restore_signal_state();
         if (options->log)
         {
index c5e5023e30a4f3f11cbf3e1ae8525583383896fa..da445c618fcad20836d555d6306ee2246ac835c9 100644 (file)
@@ -173,10 +173,17 @@ daemonize(const char *envp[])
         {
             fd = dup(2);
         }
+#if defined(__APPLE__) && defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
         if (daemon(0, 0) < 0)
         {
             warn("DOWN-ROOT: daemonization failed");
         }
+#if defined(__APPLE__) && defined(__clang__)
+#pragma clang diagnostic pop
+#endif
         else if (fd >= 3)
         {
             dup2(fd, 2);