diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-25 07:07:16 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-25 07:07:16 +0000 |
commit | 11b3854192211aefb419544d21d83e375b2a9fc1 (patch) | |
tree | f3bed4f169a627b40b3f0f30601b6a6d6b8ad113 | |
parent | b1ca6a351c18f38b9b6fb1b18347a099ae41ef18 (diff) | |
download | rsyslog-11b3854192211aefb419544d21d83e375b2a9fc1.tar.gz rsyslog-11b3854192211aefb419544d21d83e375b2a9fc1.tar.bz2 rsyslog-11b3854192211aefb419544d21d83e375b2a9fc1.zip |
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.
-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); |