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

Enhance error msg and remove superfluous semicolon #1475

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ char *iptostr(struct sockaddr *sa)
*/
int setsockname(sockname_t *addr, char *src, int port, int allowres)
{
char *endptr, *src2 = src;;
char *endptr, *src2 = src;
long val;
IP ip;
volatile int af = AF_UNSPEC;
Expand Down
17 changes: 12 additions & 5 deletions src/tcldcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,15 +1176,22 @@ static int setlisten(Tcl_Interp *irp, char *ip, char *portp, char *type, char *m
if (strlen(newip)) {
michaelortmann marked this conversation as resolved.
Show resolved Hide resolved
setsockname(&name, newip, port, 1);
i = open_address_listen(&name);
if (i < 0) {
snprintf(msg, sizeof msg, "Couldn't listen on port %d on the given "
"address '%s': %s. Please check that the port is not already in use",
realport, newip, strerror(errno));
Tcl_AppendResult(irp, msg, NULL);
return TCL_ERROR;
}
} else {
i = open_listen(&port);
}
if (i < 0) {
egg_snprintf(msg, sizeof msg, "Couldn't listen on port '%d' on the given "
if (i < 0) {
snprintf(msg, sizeof msg, "Couldn't listen on port %d on the given "
"address: %s. Please check that the port is not already in use",
realport, strerror(errno));
Tcl_AppendResult(irp, msg, NULL);
return TCL_ERROR;
Tcl_AppendResult(irp, msg, NULL);
return TCL_ERROR;
}
}
idx = new_dcc(&DCC_TELNET, 0);
dcc[idx].sockname.addrlen = sizeof(dcc[idx].sockname.addr);
Expand Down