projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Nico Golde:
[apps/madmutt.git]
/
mutt_socket.c
diff --git
a/mutt_socket.c
b/mutt_socket.c
index
2a48665
..
2cdbf25
100644
(file)
--- a/
mutt_socket.c
+++ b/
mutt_socket.c
@@
-23,6
+23,11
@@
#include "mutt_idna.h"
#include "mutt_idna.h"
+#include "lib/mem.h"
+#include "lib/intl.h"
+#include "lib/str.h"
+#include "lib/debug.h"
+
#include <unistd.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <netinet/in.h>
#include <netdb.h>
@@
-55,9
+60,7
@@
int mutt_socket_close (CONNECTION * conn)
int rc = -1;
if (conn->fd < 0)
int rc = -1;
if (conn->fd < 0)
- dprint (1,
- (debugfile,
- "mutt_socket_close: Attempt to close closed connection.\n"));
+ debug_print (1, ("Attempt to close closed connection.\n"));
else
rc = conn->conn_close (conn);
else
rc = conn->conn_close (conn);
@@
-72,9
+75,7
@@
int mutt_socket_read (CONNECTION * conn, char *buf, size_t len)
int rc;
if (conn->fd < 0) {
int rc;
if (conn->fd < 0) {
- dprint (1,
- (debugfile,
- "mutt_socket_read: attempt to read from closed connection\n"));
+ debug_print (1, ("attempt to read from closed connection\n"));
return -1;
}
return -1;
}
@@
-95,28
+96,23
@@
int mutt_socket_write_d (CONNECTION * conn, const char *buf, int dbg)
int rc;
int len;
int rc;
int len;
- d
print (dbg, (debugfile,
"> %s", buf));
+ d
ebug_print (dbg, (
"> %s", buf));
if (conn->fd < 0) {
if (conn->fd < 0) {
- dprint (1,
- (debugfile,
- "mutt_socket_write: attempt to write to closed connection\n"));
+ debug_print (1, ("attempt to write to closed connection\n"));
return -1;
}
return -1;
}
- len =
mutt
_strlen (buf);
+ len =
safe
_strlen (buf);
if ((rc = conn->conn_write (conn, buf, len)) < 0) {
if ((rc = conn->conn_write (conn, buf, len)) < 0) {
- dprint (1, (debugfile,
- "mutt_socket_write: error writing, closing socket\n"));
+ debug_print (1, ("error writing, closing socket\n"));
mutt_socket_close (conn);
return -1;
}
if (rc < len) {
mutt_socket_close (conn);
return -1;
}
if (rc < len) {
- dprint (1, (debugfile,
- "mutt_socket_write: ERROR: wrote %d of %d bytes!\n", rc,
- len));
+ debug_print (1, ("ERROR: wrote %d of %d bytes!\n", rc, len));
}
return rc;
}
return rc;
@@
-130,9
+126,7
@@
int mutt_socket_readchar (CONNECTION * conn, char *c)
conn->available =
conn->conn_read (conn, conn->inbuf, sizeof (conn->inbuf));
else {
conn->available =
conn->conn_read (conn, conn->inbuf, sizeof (conn->inbuf));
else {
- dprint (1,
- (debugfile,
- "mutt_socket_readchar: attempt to read from closed connection.\n"));
+ debug_print (1, ("attempt to read from closed connection.\n"));
return -1;
}
conn->bufpos = 0;
return -1;
}
conn->bufpos = 0;
@@
-173,9
+167,9
@@
int mutt_socket_readln_d (char *buf, size_t buflen, CONNECTION * conn,
else
buf[i] = '\0';
else
buf[i] = '\0';
- d
print (dbg, (debugfile,
"< %s\n", buf));
+ d
ebug_print (dbg, (
"< %s\n", buf));
- /* number of bytes read, not strlen */
+ /* number of bytes read, not s
afe_s
trlen */
return i + 1;
}
return i + 1;
}
@@
-276,10
+270,10
@@
static int socket_preconnect (void)
int rc;
int save_errno;
int rc;
int save_errno;
- if (
mutt
_strlen (Preconnect)) {
- d
print (2, (debugfile,
"Executing preconnect: %s\n", Preconnect));
+ if (
safe
_strlen (Preconnect)) {
+ d
ebug_print (2, (
"Executing preconnect: %s\n", Preconnect));
rc = mutt_system (Preconnect);
rc = mutt_system (Preconnect);
- d
print (2, (debugfile,
"Preconnect result: %d\n", rc));
+ d
ebug_print (2, (
"Preconnect result: %d\n", rc));
if (rc) {
save_errno = errno;
mutt_perror (_("Preconnect command failed."));
if (rc) {
save_errno = errno;
mutt_perror (_("Preconnect command failed."));
@@
-305,7
+299,7
@@
static int socket_connect (int fd, struct sockaddr *sa)
sa_size = sizeof (struct sockaddr_in6);
#endif
else {
sa_size = sizeof (struct sockaddr_in6);
#endif
else {
- d
print (1, (debugfile,
"Unknown address family!\n"));
+ d
ebug_print (1, (
"Unknown address family!\n"));
return -1;
}
return -1;
}
@@
-318,7
+312,7
@@
static int socket_connect (int fd, struct sockaddr *sa)
if (connect (fd, sa, sa_size) < 0) {
save_errno = errno;
if (connect (fd, sa, sa_size) < 0) {
save_errno = errno;
- d
print (2, (debugfile,
"Connection failed. errno: %d...\n", errno));
+ d
ebug_print (2, (
"Connection failed. errno: %d...\n", errno));
SigInt = 0; /* reset in case we caught SIGINTR while in connect() */
}
SigInt = 0; /* reset in case we caught SIGINTR while in connect() */
}