Do not use UT_LINESIZE or __UT_LINESIZE
These are not standard. For more information see issue #279. This fixes #279.
This commit is contained in:
parent
084877eb52
commit
a32b14bbb4
@ -37,10 +37,6 @@
|
|||||||
# define _PATH_DEV "/dev/"
|
# define _PATH_DEV "/dev/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef UT_LINESIZE
|
|
||||||
#define UT_LINESIZE __UT_LINESIZE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static sigjmp_buf jbuf;
|
static sigjmp_buf jbuf;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -62,7 +58,7 @@ static void getuidtty(char **userp, char **ttyp)
|
|||||||
uid_t uid;
|
uid_t uid;
|
||||||
char *tty;
|
char *tty;
|
||||||
static char uidbuf[32];
|
static char uidbuf[32];
|
||||||
static char ttynm[UT_LINESIZE + 4];
|
char *ttynm = NULL;
|
||||||
|
|
||||||
uid = getuid();
|
uid = getuid();
|
||||||
if ((pwd = getpwuid(uid)) != NULL) {
|
if ((pwd = getpwuid(uid)) != NULL) {
|
||||||
@ -82,10 +78,8 @@ static void getuidtty(char **userp, char **ttyp)
|
|||||||
if (tty[0] == '/')
|
if (tty[0] == '/')
|
||||||
tty++;
|
tty++;
|
||||||
}
|
}
|
||||||
snprintf(ttynm, sizeof(ttynm), "(%.*s) ",
|
xasprintf(&ttynm, "(%s) ", tty);
|
||||||
UT_LINESIZE, tty);
|
}
|
||||||
} else
|
|
||||||
ttynm[0] = 0;
|
|
||||||
|
|
||||||
*userp = uidbuf;
|
*userp = uidbuf;
|
||||||
*ttyp = ttynm;
|
*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",
|
xasprintf(&line, "\007\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n",
|
||||||
user, name.nodename, tty, date);
|
user, name.nodename, tty, date);
|
||||||
|
free(tty);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fork to avoid hanging in a write()
|
* Fork to avoid hanging in a write()
|
||||||
|
Loading…
Reference in New Issue
Block a user