diff --git a/0001-daemon.c-fix-condition-for-redirecting-stderr.patch b/0001-daemon.c-fix-condition-for-redirecting-stderr.patch
new file mode 100644
index 0000000..7afee92
--- /dev/null
+++ b/0001-daemon.c-fix-condition-for-redirecting-stderr.patch
@@ -0,0 +1,30 @@
+From e67d906d735166f2068f1e4cc393220483a97f30 Mon Sep 17 00:00:00 2001
+From: Lucas Werkmeister <mail@lucaswerkmeister.de>
+Date: Wed, 4 Apr 2018 00:13:07 +0200
+Subject: [PATCH] daemon.c: fix condition for redirecting stderr
+
+Since the --log-destination option was added in 0c591cacb ("daemon: add
+--log-destination=(stderr|syslog|none)", 2018-02-04) with the explicit
+goal of allowing logging to stderr when running in inetd mode, we should
+not always redirect stderr to /dev/null in inetd mode, but rather only
+when stderr is not being used for logging.
+
+Signed-off-by: Lucas Werkmeister <mail@lucaswerkmeister.de>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+---
+ daemon.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/daemon.c b/daemon.c
+index fb538e3678997..7857169055385 100644
+--- a/daemon.c
++++ b/daemon.c
+@@ -1462,7 +1462,7 @@ int cmd_main(int argc, const char **argv)
+ 		die("base-path '%s' does not exist or is not a directory",
+ 		    base_path);
+ 
+-	if (inetd_mode) {
++	if (log_destination != LOG_DESTINATION_STDERR) {
+ 		if (!freopen("/dev/null", "w", stderr))
+ 			die_errno("failed to redirect stderr to /dev/null");
+ 	}
diff --git a/git.spec b/git.spec
index 1902e10..9f88574 100644
--- a/git.spec
+++ b/git.spec
@@ -118,6 +118,8 @@ Patch0:         git-1.8-gitweb-home-link.patch
 Patch1:         git-cvsimport-Ignore-cvsps-2.2b1-Branches-output.patch
 # https://github.com/gitster/git/commit/51db271.patch
 Patch2:         0001-git-svn-avoid-warning-on-undef-readline.patch
+# https://github.com/gitster/git/commit/e67d906.patch
+Patch3:         0001-daemon.c-fix-condition-for-redirecting-stderr.patch
 
 %if %{with docs}
 BuildRequires:  asciidoc >= 8.4.1
@@ -892,6 +894,7 @@ make test || ./print-failed-test-output
 
 %changelog
 * Mon Apr 09 2018 Todd Zullinger <tmz@pobox.com>
+- daemon: fix condition for redirecting stderr
 - git-svn: avoid uninitialized value warning
 
 * Sun Apr 08 2018 Todd Zullinger <tmz@pobox.com>