Fix gethostname calls (bug #4198, with mods)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2005-05-08 16:44:25 +00:00
parent fa0f44a347
commit 00bcbaaa05
6 changed files with 17 additions and 17 deletions

View File

@@ -75,7 +75,7 @@ static struct msglist {
struct msglist *next;
} *list = NULL, *last = NULL;
static char hostname[256];
static char hostname[MAXHOSTNAMELEN];
enum logtypes {
LOGTYPE_SYSLOG,
@@ -294,7 +294,7 @@ static void init_logger_chain(void)
ast_mutex_lock(&loglock);
if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) {
if(ast_true(s)) {
if(gethostname(hostname, sizeof(hostname))) {
if(gethostname(hostname, sizeof(hostname)-1)) {
strncpy(hostname, "unknown", sizeof(hostname)-1);
ast_log(LOG_WARNING, "What box has no hostname???\n");
}