mirror of
https://github.com/git/git.git
synced 2024-12-18 06:14:59 +08:00
48bdf86995
This is a trivially correct use of sprintf, as our error number should not be excessively long. But it's still nice to drop an sprintf call. Note that we cannot use xsnprintf here, because this is compat code which does not load git-compat-util.h. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
22 lines
530 B
C
22 lines
530 B
C
#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";
|
|
}
|
|
snprintf(buffer, sizeof(buffer), "Name resolution error %d", err);
|
|
return buffer;
|
|
}
|