Changeset: 255ec3fd69d7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=255ec3fd69d7
Modified Files:
clients/src/mapilib/Mapi.mx
Branch: Jun2010
Log Message:
This code is incomplete. The gethostbyname sets the h_errno or errno depending
on the error. But it never sets both.
if you give an unknown host,
getbostbyname("whatever");
the *h_errno* is set as *Unknown* and errno it is not set, i.e., it is *0*,
therefore, strerror will print Success.
In case you give a invalid host name like:
gethostbyname(0);
the *errno* is set as *Invalid* and *h_errno* it is not set, i.e., it is *0*,
therefore, hstrerror will print Success.
diffs (12 lines):
diff -r 7a88e64c34b1 -r 255ec3fd69d7 clients/src/mapilib/Mapi.mx
--- a/clients/src/mapilib/Mapi.mx Thu Jul 22 11:53:14 2010 +0200
+++ b/clients/src/mapilib/Mapi.mx Thu Jul 22 13:16:44 2010 +0200
@@ -2405,7 +2405,7 @@
mid->hostname = strdup("localhost");
if ((hp = gethostbyname(mid->hostname)) == NULL) {
- snprintf(errbuf, sizeof(errbuf), "gethostbyname failed:
%s", strerror(errno));
+ snprintf(errbuf, sizeof(errbuf), "gethostbyname failed:
%s", errno ? strerror(errno) : hstrerror(h_errno));
return mapi_setError(mid, errbuf, "mapi_reconnect",
MERROR);
}
memset(&server, 0, sizeof(server));
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list