mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
![Jeff King](/assets/img/avatar_default.png)
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;
|
|
}
|