Skip to content

Randomize socket filename#420

Closed
jakobrs wants to merge 1 commit intoclementgallet:masterfrom
jakobrs:random-socket-filename
Closed

Randomize socket filename#420
jakobrs wants to merge 1 commit intoclementgallet:masterfrom
jakobrs:random-socket-filename

Conversation

@jakobrs
Copy link
Copy Markdown
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)

Comment thread src/program/main.cpp Outdated
@jakobrs jakobrs force-pushed the random-socket-filename branch from 30cb8b3 to a2c95b5 Compare June 14, 2021 07:17

/* Remove the socket file and return error */
int removeSocket();
int removeSocket(const std::string& socket_filename);
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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