diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2018-12-25 12:13:23 -0600 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2018-12-25 12:13:23 -0600 |
commit | a32b14bbb43e9888acaaea6f764fb8dcb34fb941 (patch) | |
tree | 3dc1f8065aaa83dbd05187c172fd13f3edd531b3 /src/rc | |
parent | 084877eb52971faf8f52c780ddd08ed9af140eb6 (diff) |
Do not use UT_LINESIZE or __UT_LINESIZE
These are not standard.
For more information see issue #279.
This fixes #279.
Diffstat (limited to 'src/rc')
-rw-r--r-- | src/rc/broadcast.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/rc/broadcast.c b/src/rc/broadcast.c index 1a29c796..47c093ce 100644 --- a/src/rc/broadcast.c +++ b/src/rc/broadcast.c @@ -37,10 +37,6 @@ # define _PATH_DEV "/dev/" #endif -#ifndef UT_LINESIZE -#define UT_LINESIZE __UT_LINESIZE -#endif - static sigjmp_buf jbuf; /* @@ -62,7 +58,7 @@ static void getuidtty(char **userp, char **ttyp) uid_t uid; char *tty; static char uidbuf[32]; - static char ttynm[UT_LINESIZE + 4]; + char *ttynm = NULL; uid = getuid(); if ((pwd = getpwuid(uid)) != NULL) { @@ -82,10 +78,8 @@ static void getuidtty(char **userp, char **ttyp) if (tty[0] == '/') tty++; } - snprintf(ttynm, sizeof(ttynm), "(%.*s) ", - UT_LINESIZE, tty); - } else - ttynm[0] = 0; + xasprintf(&ttynm, "(%s) ", tty); + } *userp = uidbuf; *ttyp = ttynm; @@ -156,6 +150,7 @@ void broadcast(char *text) xasprintf(&line, "\007\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n", user, name.nodename, tty, date); + free(tty); /* * Fork to avoid hanging in a write() |