src/FileAttributeFinder.h
branchv_0
changeset 60 bb7ca5891755
parent 44 dc5c210295d0
--- a/src/FileAttributeFinder.h	Fri Jan 24 21:05:10 2020 +0100
+++ b/src/FileAttributeFinder.h	Sat Jan 25 16:37:20 2020 +0100
@@ -55,10 +55,9 @@
 	}
 
 	void fetchOwner(const fs::path& file, string_t& owner, string_t& group) {
-		// TODO: throw exception on error
-		// TODO: get user and group in C++ way?
 		struct stat info;
-		stat(file.c_str(), &info);
+		int result = ::stat(file.c_str(), &info);
+		if (result) throw RelpipeWriterException(L"Unable to stat() file „" + file.wstring() + L"“ in fetchOwner(). Result: " + std::to_wstring(result));
 		/**
 		 * The return value may point to a static area, and may  be
 		 * overwritten  by  subsequent calls to getpwent(3), getpw‐