diff options
author | Hajimu UMEMOTO <ume@FreeBSD.org> | 2006-01-27 08:52:14 +0000 |
---|---|---|
committer | Hajimu UMEMOTO <ume@FreeBSD.org> | 2006-01-27 08:52:14 +0000 |
commit | d042befb986bfdab6e40a99b111a1a27533a537c (patch) | |
tree | b6de3c062a77f0f2e591684955c49d9d1bc72cca /usr.bin/wall | |
parent | bb802634115d02f174f9afc9fa7cd009bb68c7e1 (diff) | |
download | src-d042befb986bfdab6e40a99b111a1a27533a537c.tar.gz src-d042befb986bfdab6e40a99b111a1a27533a537c.zip |
make wall(1) work with pts.
Notes
Notes:
svn path=/head/; revision=154898
Diffstat (limited to 'usr.bin/wall')
-rw-r--r-- | usr.bin/wall/ttymsg.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/wall/ttymsg.c b/usr.bin/wall/ttymsg.c index 131cf2c403cd..a977875942ab 100644 --- a/usr.bin/wall/ttymsg.c +++ b/usr.bin/wall/ttymsg.c @@ -68,14 +68,18 @@ ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout) int cnt, fd; static char device[MAXNAMLEN] = _PATH_DEV; static char errbuf[1024]; + char *p; int forked; forked = 0; if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) return ("too many iov's (change code in wall/ttymsg.c)"); - strlcpy(device + sizeof(_PATH_DEV) - 1, line, sizeof(device)); - if (strchr(device + sizeof(_PATH_DEV) - 1, '/')) { + p = device + sizeof(_PATH_DEV) - 1; + strlcpy(p, line, sizeof(device)); + if (strncmp(p, "pts/", 4) == 0) + p += 4; + if (strchr(p, '/') != NULL) { /* A slash is an attempt to break security... */ (void) snprintf(errbuf, sizeof(errbuf), "Too many '/' in \"%s\"", device); |