Article View: gnu.emacs.bug
Article #100088Open-network-stream in emacs 18.55
From: Eric Negaard
Date: Thu, 02 Nov 1989 22:29
Date: Thu, 02 Nov 1989 22:29
65 lines
2417 bytes
2417 bytes
I was playing with open-network-stream the other day, and was
not satisfied with the error message that it returned if
the connect failed. I added checks for a few common errors
so that the messages returned are useful.
Eric Negaard
negaard@aerospace.aero.org
...!uunet!aero.org!negaard
diff -c process.c.old process.c
*** process.c.old Thu Nov 2 09:52:15 1989
--- process.c Tue Oct 24 10:07:48 1989
***************
*** 1119,1124 ****
--- 1134,1140 ----
int s, outch, inch;
char errstring[80];
int port;
+ int xerrno;
CHECK_STRING (name, 0);
CHECK_STRING (host, 0);
***************
*** 1146,1155 ****
if (s < 0)
report_file_error ("error creating socket", Fcons (name, Qnil));
if (connect (s, &address, sizeof address) == -1)
{
close (s);
! error ("Host \"%s\" not responding", XSTRING (host)->data);
}
inch = s;
--- 1162,1191 ----
if (s < 0)
report_file_error ("error creating socket", Fcons (name, Qnil));
+ loop:
if (connect (s, &address, sizeof address) == -1)
{
+ if (errno == EINTR)
+ goto loop;
+ xerrno = errno;
close (s);
! #ifdef ECONNREFUSED
! if (xerrno == ECONNREFUSED)
! error ("Connection refused by host \"%s\"", XSTRING (host)->data);
! else
! #endif
! #ifdef ENETUNREACH
! if (xerrno == ENETUNREACH)
! error ("\"%s\": Network is unreachable", XSTRING (host)->data);
! else
! #endif
! #ifdef ETIMEDOUT
! if (xerrno == ETIMEDOUT)
! error ("Host \"%s\" not responding", XSTRING (host)->data);
! else
! #endif
! error ("Can't connect to Host \"%s\"", XSTRING (host)->data);
}
inch = s;
Technical Details
Message-ID:
<NEGAARD.89Nov2142940@fungus.aero.org>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu-cs!lll-winken!brutus.cs.uiuc.edu!wuarchive!cs.utexas.edu!samsung!usc!aero!negaardShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,d4a0478a8518ca2b,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1989-11-04 13:39:15 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu-cs!lll-winken!brutus.cs.uiuc.edu!wuarchive!cs.utexas.edu!samsung!usc!aero!negaard From: negaard@aero.org (Eric Negaard) Newsgroups: gnu.emacs.bug Subject: Open-network-stream in emacs 18.55 Message-ID: <NEGAARD.89Nov2142940@fungus.aero.org> Date: 2 Nov 89 22:29:40 GMT Sender: news@aerospace.aero.org Distribution: gnu Organization: The Aerospace Corporation, El Segundo, CA Lines: 65 Posted: Thu Nov 2 23:29:40 1989