summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 18a9368)
raw | patch | inline | side by side (parent: 18a9368)
author | Alex Riesen <raa.lkml@gmail.com> | |
Wed, 13 Jun 2007 18:54:32 +0000 (20:54 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 16 Jun 2007 05:48:34 +0000 (22:48 -0700) |
The function converts the value of h_errno (last error of name
resolver library, see netdb.h).
One of systems which supposedly do not have the function is SunOS.
POSIX does not mandate its presence.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
resolver library, see netdb.h).
One of systems which supposedly do not have the function is SunOS.
POSIX does not mandate its presence.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile | patch | blob | history | |
compat/hstrerror.c | [new file with mode: 0644] | patch | blob |
git-compat-util.h | patch | blob | history |
diff --git a/Makefile b/Makefile
index fb11fa1987e162c13a9fba492da41e26fdad7195..862c2682aa39b424bb3349e4e885409c94a0df42 100644 (file)
--- a/Makefile
+++ b/Makefile
NEEDS_NSL = YesPlease
SHELL_PATH = /bin/bash
NO_STRCASESTR = YesPlease
+ NO_HSTRERROR = YesPlease
ifeq ($(uname_R),5.8)
NEEDS_LIBICONV = YesPlease
NO_UNSETENV = YesPlease
ifdef NO_PERL_MAKEMAKER
export NO_PERL_MAKEMAKER
endif
+ifdef NO_HSTRERROR
+ COMPAT_CFLAGS += -DNO_HSTRERROR
+ COMPAT_OBJS += compat/hstrerror.o
+endif
ifeq ($(TCLTK_PATH),)
NO_TCLTK=NoThanks
diff --git a/compat/hstrerror.c b/compat/hstrerror.c
--- /dev/null
+++ b/compat/hstrerror.c
@@ -0,0 +1,21 @@
+#include <string.h>
+#include <stdio.h>
+#include <netdb.h>
+
+const char *githstrerror(int err)
+{
+ static char buffer[48];
+ switch (err)
+ {
+ case HOST_NOT_FOUND:
+ return "Authoritative answer: host not found";
+ case NO_DATA:
+ return "Valid name, no data record of requested type";
+ case NO_RECOVERY:
+ return "Non recoverable errors, FORMERR, REFUSED, NOTIMP";
+ case TRY_AGAIN:
+ return "Non-authoritative \"host not found\", or SERVERFAIL";
+ }
+ sprintf(buffer, "Name resolution error %d", err);
+ return buffer;
+}
diff --git a/git-compat-util.h b/git-compat-util.h
index 6bd8987b2774774fbbd3747a2b571b66ad78727b..b2ab3f82567d54607a07f4061153adae86854fa9 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
extern uintmax_t gitstrtoumax(const char *, char **, int);
#endif
+#ifdef NO_HSTRERROR
+#define hstrerror githstrerror
+extern const char *githstrerror(int herror);
+#endif
+
extern void release_pack_memory(size_t, int);
static inline char* xstrdup(const char *str)