[Pkg-wmaker-commits] [wmbiff] 31/38: avoid repetitive error messages when hostname lookup fails (such as when disconnected)

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:03:41 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_4_16
in repository wmbiff.

commit 4a7cf1b9b6c4356de62c20b0cbb6db0778445348
Author: bluehal <bluehal>
Date:   Thu Jul 3 05:34:22 2003 +0000

    avoid repetitive error messages when hostname lookup fails (such as when disconnected)
---
 wmbiff/socket.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/wmbiff/socket.c b/wmbiff/socket.c
index 6e3bde7..3748466 100644
--- a/wmbiff/socket.c
+++ b/wmbiff/socket.c
@@ -1,4 +1,4 @@
-/* $Id: socket.c,v 1.8 2003/03/02 02:17:14 bluehal Exp $ */
+/* $Id: socket.c,v 1.9 2003/07/03 05:34:22 bluehal Exp $ */
 /* Copyright (C) 1998 Trent Piepho  <xyzzy at u.washington.edu>
  *           (C) 1999 Trent Piepho  <xyzzy at speakeasy.org>
  *
@@ -73,7 +73,13 @@ int sock_connect(const char *hostname, int port)
 	snprintf(pbuf, sizeof(pbuf), "%d", port);
 	error = getaddrinfo(hostname, pbuf, &hints, &res0);
 	if (error) {
-		printf("%s: %s\n", hostname, gai_strerror(error));
+		static int last_error;
+		if (last_error != error) {
+			/* only report a problem if it's new.  this is an 
+			   approximation that minimizes kept state. */
+			printf("%s: %s\n", hostname, gai_strerror(error));
+			last_error = error;
+		}
 		return -1;
 	}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list