[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [PATCH 2.8.5-pre4] gethost...


This patch falls back to the "normal" behaviour if fork() fails.

Enjoy,
Ilya

--- ./WWW/Library/Implementation/HTTCP.c-pre	Sat Jan 24 17:51:04 2004
+++ ./WWW/Library/Implementation/HTTCP.c	Mon Feb  2 22:43:30 2004
@@ -912,6 +913,23 @@ PUBLIC struct hostent * LYGetHostByName 
 
 	if (fpid < 0) {     /* fork failed */
 		close(pfd[0]);
+
+		/* Retry the usual way */
+		{
+		    struct hostent  *phost;
+		    phost = gethostbyname(host);	/* See netdb.h */
+#ifdef MVS
+		    CTRACE((tfp, "LYGetHostByName: gethostbyname() returned %d\n", phost));
+#endif /* MVS */
+		    if (phost) {
+		        lynx_nsl_status = HT_OK;
+		        result_phost = phost;
+			goto done;
+		    } else {
+		        lynx_nsl_status = HT_H_ERRNO_VALID;
+		        goto failed;
+		    }
+		}
 		goto failed;
 	}
 
@@ -1154,6 +1172,7 @@ PUBLIC struct hostent * LYGetHostByName 
 #endif /* !NSL_FORK, !_WINDOWS_NSL */
 #endif /* !NSL_FORK */
 
+  done:
 #ifdef DEBUG_HOSTENT
     dump_hostent("End of LYGetHostByName", result_phost);
     CTRACE((tfp, "LYGetHostByName: Resolved name to a hostent.\n"));

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to majordomo@xxxxxxx



This mailing list archive is a service of Copilot Consulting.