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

Randomize socket filename #420

Closed
wants to merge 1 commit into from

Conversation

jakobrs
Copy link
Contributor

@jakobrs jakobrs commented Jun 14, 2021

I'll probably want to find a way to use something other than tmpnam to generate the name of the socket, because:

  • Using tmpnam causes a deprecation warning
  • There is a possibility of someone else creating a file with the same name as ours by accident

There is also the fact that it leaves undeleted socket files in /tmp (but so did it before the patch too, it's just more obvious when the files get a different name each time)

src/program/main.cpp Outdated Show resolved Hide resolved
@@ -24,10 +24,15 @@
#include <string>

/* Remove the socket file and return error */
int removeSocket();
int removeSocket(const std::string& socket_filename);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of a const std::string&, an std::string_view could be used instead.


/* Initiate a socket connection with the game */
bool initSocketProgram(void);
bool initSocketProgram(const std::string& socket_filename);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

@jakobrs jakobrs force-pushed the random-socket-filename branch 3 times, most recently from 08b70b5 to 5607e57 Compare June 14, 2021 08:49
@jakobrs
Copy link
Contributor Author

jakobrs commented Jul 8, 2021

Closing in favour of #425.

@jakobrs jakobrs closed this Jul 8, 2021
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