/* in the beginning of the dialog */
/* attempt reconnect if the first Post fail */
if ((res = Post(Buffer)) != SUCCESS) {
- MailConnect();
+ int err = MailConnect();
+ if (0 != err) {
+ return (FAILED_TO_SEND);
+ }
+
if ((res = Post(Buffer)) != SUCCESS) {
return (res);
}
/* Get our own host name */
if (gethostname(LocalHost, HOST_NAME_LEN)) {
+ closesocket(sc);
return (FAILED_TO_GET_HOSTNAME);
}
ent = gethostbyname(LocalHost);
if (!ent) {
+ closesocket(sc);
return (FAILED_TO_GET_HOSTNAME);
}
#endif
{
if (namelen + 2 >= HOST_NAME_LEN) {
+ closesocket(sc);
return (FAILED_TO_GET_HOSTNAME);
}
strcpy(LocalHost + namelen + 1, "]");
} else {
if (namelen >= HOST_NAME_LEN) {
+ closesocket(sc);
return (FAILED_TO_GET_HOSTNAME);
}
sock_in.sin_addr.S_un.S_addr = GetAddr(MailHost);
if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in))) {
+ closesocket(sc);
return (FAILED_TO_CONNECT);
}