Ticket #458 (new defect)

Opened 5 years ago

telldusd: If bind fails, telldusd loops infinitely

Reported by: c h <kalvdans@…> Owned by:
Priority: major Milestone:
Component: telldus-core Version: 2.0
Keywords: Cc:
Blocked By: Blocking:
Platform: Linux Sensitive: no
Verified by Telldus: no


If telldusd fails to bind(2) to /tmp/TelldusEvents, the following accept(2) will also fail and it starts looping infinitely. With the following patch, it instead gives up. The patch should not be committed as it is, since I don't know what the proper way of handling the error should be. I can create a proper pull request if you agree that simply closing the listener is ok.

+++ b/telldus-core/service/ConnectionListener_unix.cpp
@@ -65,7 +65,10 @@ void ConnectionListener::run() {

strncpy(name.sun_path, d->name.c_str(), sizeof(name.sun_path));
int size = SUN_LEN(&name);

  • bind(serverSocket, (struct sockaddr *)&name, size);

+ if (bind(serverSocket, (struct sockaddr *)&name, size) < 0) {
+ perror(name.sun_path);
+ return;
+ }

listen(serverSocket, 5);

Change permissions to allow everyone

Note: See TracTickets for help on using tickets.