Skip to content

Commit

Permalink
MailServer: Check for error returned by read on connect.
Browse files Browse the repository at this point in the history
Fixes #67.
  • Loading branch information
dburkart committed Dec 6, 2024
1 parent e1a8a0f commit 2175ddc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Server/MailServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ void MailServer::_connect()

char buffer[1024] = {};
send(_socket, "", 0, 0);
read(_socket, buffer, 1024);

if (read(_socket, buffer, 1024) == -1) {
std::cout << "Could not read from socket: " << strerror(errno) << std::endl;
abort();
}

_greeting = std::string(buffer);
}
Expand Down

0 comments on commit 2175ddc

Please sign in to comment.