Skip to content

Commit

Permalink
Fix incorrect "Failed to shutdown socket 0" warning at exit
Browse files Browse the repository at this point in the history
Broken in 5c15e77, but did not show itself in all circumstances.

Closes #404 reported by @nicknaychov.
  • Loading branch information
wdoekes committed Jun 4, 2019
1 parent 1947584 commit dadec9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void screen_show_errors() {
return;
}

fprintf(stderr, "%sx\n", screen_last_error);
fprintf(stderr, "%s\n", screen_last_error);
if (screen_errors > 1) {
if (screen_logfile[0] != '\0') {
fprintf(stderr,
Expand Down
8 changes: 4 additions & 4 deletions src/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,8 @@ void SIPpSocket::invalidate()
WARNING_NO("Failed to delete FD from epoll");
}
#endif
}
if (ss_fd != -1 && ss_fd != stdin_fileno) {
if (ss_transport != T_UDP) {
if (shutdown(ss_fd, SHUT_RDWR) < 0) {
WARNING_NO("Failed to shutdown socket %d", ss_fd);
Expand All @@ -969,18 +971,16 @@ void SIPpSocket::invalidate()
}
#endif

if (ss_fd == stdin_fileno) {
/* don't close stdin, breaks interactive terminals */
} else if (::close(ss_fd) < 0) {
if (::close(ss_fd) < 0) {
WARNING_NO("Failed to close socket %d", ss_fd);
}
ss_fd = -1;
}

if ((pollidx = ss_pollidx) >= pollnfds) {
ERROR("Pollset error: index %d is greater than number of fds %d!", pollidx, pollnfds);
}

ss_fd = -1;
ss_invalid = true;
ss_pollidx = -1;

Expand Down

0 comments on commit dadec9a

Please sign in to comment.