MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ restrict_unix_socket_to_owner()

Acquired< void > MayaFlux::Platform::restrict_unix_socket_to_owner ( const std::filesystem::path & path)
inlinenodiscard

Make a bound socket file usable by its owner only.

Call after bind. On POSIX the file mode becomes owner read and write, whatever the umask was. On Windows this does nothing and the file keeps the access its directory gives it.

Definition at line 281 of file UnixSocket.hpp.

282{
283#if defined(MAYAFLUX_PLATFORM_WINDOWS)
284 (void)path;
285 return {};
286#else
287 std::error_code ec;
288 std::filesystem::permissions(path,
289 std::filesystem::perms::owner_read | std::filesystem::perms::owner_write,
290 std::filesystem::perm_options::replace, ec);
291 if (ec) {
292 return std::unexpected(detail::make_failure(AcquireFailure::Reason::Unsafe, path.string(), { path }));
293 }
294 return {};
295#endif
296}
AcquireFailure make_failure(AcquireFailure::Reason reason, std::string request, std::vector< std::filesystem::path > tried={})

References MayaFlux::Platform::detail::make_failure(), and MayaFlux::Platform::AcquireFailure::Unsafe.

Referenced by MayaFlux::Core::UdsTransport::bind().

Here is the call graph for this function:
Here is the caller graph for this function: