summaryrefslogtreecommitdiffstats
path: root/usr.bin/write/write.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
commitb9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch)
tree72b2433e418dfa1aef5fcf8305617b97979a25d8 /usr.bin/write/write.c
parentimprove checksum parsing slightly. now handles filenames with spaces. (diff)
downloadwireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz
wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'usr.bin/write/write.c')
-rw-r--r--usr.bin/write/write.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c
index 321bb42a5c0..be3bc10b964 100644
--- a/usr.bin/write/write.c
+++ b/usr.bin/write/write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write.c,v 1.27 2013/04/16 19:24:55 deraadt Exp $ */
+/* $OpenBSD: write.c,v 1.28 2015/01/16 06:40:14 deraadt Exp $ */
/* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */
/*
@@ -33,7 +33,6 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
@@ -45,6 +44,7 @@
#include <paths.h>
#include <pwd.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#include <err.h>
#include <vis.h>
@@ -59,7 +59,7 @@ int utmp_chk(char *, char *);
int
main(int argc, char *argv[])
{
- char tty[MAXPATHLEN], *mytty, *cp;
+ char tty[PATH_MAX], *mytty, *cp;
int msgsok, myttyfd;
time_t atime;
uid_t myuid;
@@ -204,7 +204,7 @@ int
term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror)
{
struct stat s;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
(void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);
if (stat(path, &s) < 0) {
@@ -226,7 +226,7 @@ do_write(char *tty, char *mytty, uid_t myuid)
char *login, *nows;
struct passwd *pwd;
time_t now;
- char path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512];
+ char path[PATH_MAX], host[HOST_NAME_MAX+1], line[512];
gid_t gid;
/* Determine our login name before the we reopen() stdout */