mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
fix: broken unix socket support (#5665)
The changes in #5523 made two errors in the new implementation 1. tr_unix_address::to_string() got the ternary check backwards, leading to always printing an empty string when the address is valid. 2. The inputs to tr_strvStartsWith in tr_unix_address::from_string() were backwards as well, leading to the check failing for valid socket addresses. Co-authored-by: LaserEyess <LaserEyess@users.noreply.github.com>
This commit is contained in:
parent
46dac775e0
commit
9b5a75528e
1 changed files with 2 additions and 2 deletions
|
@ -86,12 +86,12 @@ class tr_unix_addr
|
|||
public:
|
||||
[[nodiscard]] std::string to_string() const
|
||||
{
|
||||
return std::empty(unix_socket_path_) ? unix_socket_path_ : std::string(TrUnixSocketPrefix);
|
||||
return std::empty(unix_socket_path_) ? std::string(TrUnixSocketPrefix) : unix_socket_path_;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool from_string(std::string_view src)
|
||||
{
|
||||
if (!tr_strvStartsWith(TrUnixSocketPrefix, src))
|
||||
if (!tr_strvStartsWith(src, TrUnixSocketPrefix))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue