-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a local implementation of hstrerror for the system which do not h…
…ave it 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>
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters