diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | syslogd.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 4bd48eb9..ff32d57d 100644 --- a/configure.ac +++ b/configure.ac @@ -66,7 +66,7 @@ AC_TYPE_SIGNAL AC_FUNC_STAT AC_FUNC_VPRINTF AC_FUNC_WAIT3 -AC_CHECK_FUNCS([setsid alarm gethostbyname gethostname gettimeofday memset regcomp select socket strcasecmp strchr strerror strerror_r strndup strnlen strrchr strstr strtol strtoul uname]) +AC_CHECK_FUNCS([setsid alarm gethostbyname gethostname gettimeofday memset regcomp select socket strcasecmp strchr strerror strerror_r strndup strnlen strrchr strstr strtol strtoul uname ttyname_r]) # Large file support @@ -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); |