Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clipmenud: avoid spawning multiple daemons #221

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

N-R-K
Copy link
Contributor

@N-R-K N-R-K commented Jun 6, 2024

things can get messy if a running clipmenud is diabled via clipctl and then another clipmenud daemon is started. avoid spawning multiple daemons by using a session lock similar to the old bash script.

Copy link
Owner

@cdown cdown left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -384,6 +385,14 @@ int main(void) {
int evt_base;

cfg = setup("clipmenud");

_drop_(close) int session_fd =
Copy link
Owner

Choose a reason for hiding this comment

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

Probably also O_CLOEXEC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. But does clipmenud do any exec? Also what about content_dir_fd and snip_fd, shouldn't they be O_CLOEXECed too if it's just out of precaution/principle?

Copy link
Owner

@cdown cdown Jun 8, 2024

Choose a reason for hiding this comment

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

O_CLOEXEC is more important on flock()ed files than regular files because flock() maintains locking semantics across process images, so (for example) clipserve may then end up holding the lock. It would be cleaner elsewhere, too, but less essential.

We do fork()/exec() on run_clipserve().

things can get messy if a running clipmenud is diabled via
clipctl and then another clipmenud daemon is started. avoid
spawning multiple daemons by using a session lock similar to the
old bash script.
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.

2 participants