From d0c2c187633fa906eee672c21f46a2ac68148d15 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 3 Feb 1999 02:55:59 +0000 Subject: Simplify error reporting further. svn path=/trunk/; revision=2374 --- socket.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'socket.c') diff --git a/socket.c b/socket.c index d95c043d..8f559799 100644 --- a/socket.c +++ b/socket.c @@ -52,13 +52,13 @@ static int handle_plugin(const char *host, int fds[2]; if (socketpair(AF_UNIX,SOCK_STREAM,0,fds)) { - report(stderr, errno, _("fetchmail: socketpair failed\n")); + report(stderr, _("fetchmail: socketpair failed\n")); return -1; } switch (fork()) { case -1: /* error */ - report(stderr, errno, _("fetchmail: fork failed\n")); + report(stderr, _("fetchmail: fork failed\n")); return -1; break; case 0: /* child */ @@ -66,15 +66,15 @@ static int handle_plugin(const char *host, ** detection */ (void) close(fds[1]); if ( (dup2(fds[0],0) == -1) || (dup2(fds[0],1) == -1) ) { - report(stderr, errno, _("dup2 failed\n")); + report(stderr, _("dup2 failed\n")); exit(1); } /* fds[0] is now connected to 0 and 1; close it */ (void) close(fds[0]); if (outlevel >= O_VERBOSE) - report(stderr, 0, _("running %s %s %s\n"), plugin, host, service); + report(stderr, _("running %s %s %s\n"), plugin, host, service); execlp(plugin,plugin,host,service,0); - report(stderr, errno, _("execl(%s) failed\n"), plugin); + report(stderr, _("execl(%s) failed\n"), plugin); exit(0); break; default: /* parent */ @@ -91,7 +91,6 @@ static int handle_plugin(const char *host, int SockOpen(const char *host, const char *service, const char *options, const char *plugin) { - int i; struct addrinfo *ai, req; #if NET_SECURITY void *request = NULL; @@ -105,8 +104,8 @@ int SockOpen(const char *host, const char *service, const char *options, memset(&req, 0, sizeof(struct addrinfo)); req.ai_socktype = SOCK_STREAM; - if (i = getaddrinfo(host, service, &req, &ai)) { - report(stderr, i, _("fetchmail: getaddrinfo(%s.%s)\n"), host,service); + if (getaddrinfo(host, service, &req, &ai)) { + report(stderr, _("fetchmail: getaddrinfo(%s.%s)\n"), host,service); return -1; }; @@ -186,7 +185,7 @@ int SockOpen(const char *host, int clientPort, const char *options, if(hp->h_length != 4 && hp->h_length != 8) { h_errno = errno = 0; - report(stderr, 0, + report(stderr, _("fetchmail: illegal address length received for host %s\n"),host); return -1; } -- cgit v1.2.3