# include "config.h"
#endif
+#include <lib-lib/mem.h>
+#include <lib-lib/macros.h>
+
#include "mutt.h"
#include "globals.h"
#include "mutt_socket.h"
#include "mutt_idna.h"
-#include "lib/mem.h"
-#include "lib/intl.h"
#include "lib/str.h"
#include "lib/debug.h"
/* head is special case, doesn't need prev updated */
if (iter == conn) {
Connections = iter->next;
- mem_free (&iter);
+ p_delete(&iter);
return;
}
if (iter->next == conn) {
tmp = iter->next;
iter->next = tmp->next;
- mem_free (&tmp);
+ p_delete(&tmp);
return;
}
iter = iter->next;
if (Tunnel && *Tunnel)
mutt_tunnel_socket_setup (conn);
else if (account->flags & M_ACCT_SSL) {
-#ifdef USE_SSL
- ssl_socket_setup (conn);
-#elif USE_GNUTLS
- if (mutt_gnutls_socket_setup (conn) < 0) {
+#if defined (USE_SSL) || defined (USE_GNUTLS)
+ if (mutt_ssl_socket_setup (conn) < 0) {
mutt_socket_free (conn);
return NULL;
}
{
CONNECTION *conn;
- conn = (CONNECTION *) mem_calloc (1, sizeof (CONNECTION));
+ conn = p_new(CONNECTION, 1);
conn->fd = -1;
return conn;
rc = getaddrinfo (host_idna, port, &hints, &res);
# ifdef HAVE_LIBIDN
- mem_free (&host_idna);
+ p_delete(&host_idna);
# endif
if (rc) {
mutt_error (_("Could not find the host \"%s\""), conn->account.host);
+ mutt_sleep (2);
return -1;
}
if ((he = gethostbyname (host_idna)) == NULL) {
# ifdef HAVE_LIBIDN
- mem_free (&host_idna);
+ p_delete(&host_idna);
# endif
mutt_error (_("Could not find the host \"%s\""), conn->account.host);
}
# ifdef HAVE_LIBIDN
- mem_free (&host_idna);
+ p_delete(&host_idna);
# endif
mutt_message (_("Connecting to %s..."), conn->account.host);
if (fd >= 0) {
if ((rc = socket_connect (fd, (struct sockaddr *) &sin)) == 0) {
+ fcntl (fd, F_SETFD, FD_CLOEXEC);
conn->fd = fd;
break;
}