summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-09-25 07:07:16 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-09-25 07:07:16 +0000
commit11b3854192211aefb419544d21d83e375b2a9fc1 (patch)
treef3bed4f169a627b40b3f0f30601b6a6d6b8ad113 /syslogd.c
parentb1ca6a351c18f38b9b6fb1b18347a099ae41ef18 (diff)
downloadrsyslog-11b3854192211aefb419544d21d83e375b2a9fc1.tar.gz
rsyslog-11b3854192211aefb419544d21d83e375b2a9fc1.tar.xz
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.
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c6
1 files changed, 3 insertions, 3 deletions
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);