From 11b3854192211aefb419544d21d83e375b2a9fc1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 25 Sep 2007 07:07:16 +0000 Subject: changed ttyname() to ttyname_r() - not a real fix, as this part of the code was single threaded, but better to be prepared for the future. --- syslogd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'syslogd.c') diff --git a/syslogd.c b/syslogd.c index 58e6a112..dd8a1f95 100644 --- a/syslogd.c +++ b/syslogd.c @@ -4384,12 +4384,12 @@ static void init(void) * We ignore any errors while doing this - we would be lost anyhow... */ selector_t *f = NULL; - char *pTTY = ttyname(0); + char szTTYNameBuf[TTY_NAME_MAX+1]; /* +1 for NULL character */ dbgprintf("primary config file could not be opened - using emergency definitions.\n"); cfline((uchar*)"*.ERR\t" _PATH_CONSOLE, &f); cfline((uchar*)"*.PANIC\t*", &f); - if(pTTY != NULL) { - snprintf(cbuf,sizeof(cbuf), "*.*\t%s", pTTY); + if(ttyname_r(0, szTTYNameBuf, sizeof(szTTYNameBuf)) == 0) { + snprintf(cbuf,sizeof(cbuf), "*.*\t%s", szTTYNameBuf); cfline((uchar*)cbuf, &f); } selectorAddList(f); -- cgit v1.2.3