From e609c8833498e43b024b8742ec5b7a99e2be0760 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Wed, 19 Feb 2014 23:49:34 +0100
Subject: [PATCH] Listen: reduce overhead for builds without systemd

---
 src/Listen.cxx | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/Listen.cxx b/src/Listen.cxx
index 85a7f1c41..b967ee3b8 100644
--- a/src/Listen.cxx
+++ b/src/Listen.cxx
@@ -77,10 +77,11 @@ listen_add_config_param(unsigned int port,
 	}
 }
 
+#ifdef ENABLE_SYSTEMD_DAEMON
+
 static bool
 listen_systemd_activation(Error &error_r)
 {
-#ifdef ENABLE_SYSTEMD_DAEMON
 	int n = sd_listen_fds(true);
 	if (n <= 0) {
 		if (n < 0)
@@ -95,12 +96,10 @@ listen_systemd_activation(Error &error_r)
 			return false;
 
 	return true;
-#else
-	(void)error_r;
-	return false;
-#endif
 }
 
+#endif
+
 bool
 listen_global_init(EventLoop &loop, Partition &partition, Error &error)
 {
@@ -111,11 +110,13 @@ listen_global_init(EventLoop &loop, Partition &partition, Error &error)
 
 	listen_socket = new ClientListener(loop, partition);
 
+#ifdef ENABLE_SYSTEMD_DAEMON
 	if (listen_systemd_activation(error))
 		return true;
 
 	if (error.IsDefined())
 		return false;
+#endif
 
 	if (param != nullptr) {
 		/* "bind_to_address" is configured, create listeners