From f4f21f462d2498dc48b2de66b4d64d5334916d93 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 28 Feb 2015 21:30:51 +0100 Subject: fs/CheckFile: convert path to UTF-8 for error message --- src/fs/CheckFile.cxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/fs/CheckFile.cxx b/src/fs/CheckFile.cxx index 0068db639..e900fe9af 100644 --- a/src/fs/CheckFile.cxx +++ b/src/fs/CheckFile.cxx @@ -41,23 +41,28 @@ CheckDirectoryReadable(Path path_fs) } if (!fi.IsDirectory()) { + const auto path_utf8 = path_fs.ToUTF8(); FormatError(config_domain, - "Not a directory: %s", path_fs.c_str()); + "Not a directory: %s", path_utf8.c_str()); return; } #ifndef WIN32 const auto x = AllocatedPath::Build(path_fs, PathTraitsFS::CURRENT_DIRECTORY); - if (!GetFileInfo(x, fi) && errno == EACCES) + if (!GetFileInfo(x, fi) && errno == EACCES) { + const auto path_utf8 = path_fs.ToUTF8(); FormatError(config_domain, "No permission to traverse (\"execute\") directory: %s", - path_fs.c_str()); + path_utf8.c_str()); + } #endif const DirectoryReader reader(path_fs); - if (reader.HasFailed() && errno == EACCES) + if (reader.HasFailed() && errno == EACCES) { + const auto path_utf8 = path_fs.ToUTF8(); FormatError(config_domain, - "No permission to read directory: %s", path_fs.c_str()); - + "No permission to read directory: %s", + path_utf8.c_str()); + } } -- cgit v1.2.3