* [PATCH] support_format_hostent: Add more error information for NETDB_INTERNAL
@ 2017-09-04 17:32 Florian Weimer
2017-09-05 17:55 ` Adhemerval Zanella
0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2017-09-04 17:32 UTC (permalink / raw)
To: libc-alpha
2017-09-04 Florian Weimer <fweimer@redhat.com>
* support/support_format_hostent.c (support_format_hostent): Add
more error information for NETDB_INTERNAL.
diff --git a/support/support_format_hostent.c b/support/support_format_hostent.c
index 5b5f26082e..88c85ec1f1 100644
--- a/support/support_format_hostent.c
+++ b/support/support_format_hostent.c
@@ -19,6 +19,7 @@
#include <support/format_nss.h>
#include <arpa/inet.h>
+#include <errno.h>
#include <stdio.h>
#include <support/support.h>
#include <support/xmemstream.h>
@@ -41,10 +42,15 @@ support_format_hostent (struct hostent *h)
{
if (h == NULL)
{
- char *value = support_format_herrno (h_errno);
- char *result = xasprintf ("error: %s\n", value);
- free (value);
- return result;
+ if (h_errno == NETDB_INTERNAL)
+ return xasprintf ("error: NETDB_INTERNAL (errno %d, %m)\n", errno);
+ else
+ {
+ char *value = support_format_herrno (h_errno);
+ char *result = xasprintf ("error: %s\n", value);
+ free (value);
+ return result;
+ }
}
struct xmemstream mem;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] support_format_hostent: Add more error information for NETDB_INTERNAL
2017-09-04 17:32 [PATCH] support_format_hostent: Add more error information for NETDB_INTERNAL Florian Weimer
@ 2017-09-05 17:55 ` Adhemerval Zanella
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2017-09-05 17:55 UTC (permalink / raw)
To: libc-alpha
On 04/09/2017 14:32, Florian Weimer wrote:
> 2017-09-04 Florian Weimer <fweimer@redhat.com>
>
> * support/support_format_hostent.c (support_format_hostent): Add
> more error information for NETDB_INTERNAL.
LGTM.
>
> diff --git a/support/support_format_hostent.c b/support/support_format_hostent.c
> index 5b5f26082e..88c85ec1f1 100644
> --- a/support/support_format_hostent.c
> +++ b/support/support_format_hostent.c
> @@ -19,6 +19,7 @@
> #include <support/format_nss.h>
>
> #include <arpa/inet.h>
> +#include <errno.h>
> #include <stdio.h>
> #include <support/support.h>
> #include <support/xmemstream.h>
> @@ -41,10 +42,15 @@ support_format_hostent (struct hostent *h)
> {
> if (h == NULL)
> {
> - char *value = support_format_herrno (h_errno);
> - char *result = xasprintf ("error: %s\n", value);
> - free (value);
> - return result;
> + if (h_errno == NETDB_INTERNAL)
> + return xasprintf ("error: NETDB_INTERNAL (errno %d, %m)\n", errno);
> + else
> + {
> + char *value = support_format_herrno (h_errno);
> + char *result = xasprintf ("error: %s\n", value);
> + free (value);
> + return result;
> + }
> }
>
> struct xmemstream mem;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-05 17:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-04 17:32 [PATCH] support_format_hostent: Add more error information for NETDB_INTERNAL Florian Weimer
2017-09-05 17:55 ` Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).