From cdcee16738973b1cdc17231fd633e19d97a287cb Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Wed, 29 Jan 2025 08:24:41 +0100
Subject: [PATCH] client/File: improve error message

Users are confused by "Access denied".  Let's write an error message
that is more clear.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2184
---
 src/client/File.cxx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/client/File.cxx b/src/client/File.cxx
index 04f2df817..2688494cb 100644
--- a/src/client/File.cxx
+++ b/src/client/File.cxx
@@ -28,7 +28,7 @@ Client::AllowFile(Path path_fs) const
 #ifdef _WIN32
 	(void)path_fs;
 
-	throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
+	throw ProtocolError(ACK_ERROR_PERMISSION, "Access to local files not implemented on Windows");
 #else
 	if (uid >= 0 && (uid_t)uid == geteuid())
 		/* always allow access if user runs his own MPD
@@ -37,12 +37,12 @@ Client::AllowFile(Path path_fs) const
 
 	if (uid < 0)
 		/* unauthenticated client */
-		throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
+		throw ProtocolError(ACK_ERROR_PERMISSION, "Access to local files via TCP is not allowed");
 
 	const FileInfo fi(path_fs);
 
 	if (fi.GetUid() != (uid_t)uid && (fi.GetMode() & 0444) != 0444)
 		/* client is not owner */
-		throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
+		throw ProtocolError(ACK_ERROR_PERMISSION, "Access to this local file denied due to file permissions");
 #endif
 }