mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
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:
4
logger.c
4
logger.c
@@ -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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user