Skip to content

Minor tweaks to std::mutex uses - #8922

Merged
nbolton merged 2 commits into
deskflow:masterfrom
jwakely:patch-1
Sep 4, 2025
Merged

Minor tweaks to std::mutex uses#8922
nbolton merged 2 commits into
deskflow:masterfrom
jwakely:patch-1

Conversation

@jwakely

@jwakely jwakely commented Sep 4, 2025

Copy link
Copy Markdown
Contributor

Addressing my comments on #8674

POSIX says to prefer inet_ntop to inet_ntoa even for IPv4 because it's thread-safe.
https://pubs.opengroup.org/onlinepubs/9799919799/functions/inet_ntoa.html

@sithlord48

Copy link
Copy Markdown
Member

please use refactor: to start the commit messages

@sithlord48 sithlord48 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok need updates to the commit messages.

The `static` keyword was removed by deskflow#8674 but I think it should be
restored so that this global can't clash with anything else called
`::s_mutex` elsewhere in the executable.
There's no need to hold the mutex while constructing a `std::string`
from the `char` string.

Also use `inet_ntop` instead of the potentially thread-unsafe
`inet_ntoa` that might use a static buffer for the result.

This makes the `INet` case match the `INet6` case below.
@sithlord48
sithlord48 requested a review from nbolton September 4, 2025 13:50
@nbolton
nbolton merged commit f98f8b1 into deskflow:master Sep 4, 2025
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants