summaryrefslogtreecommitdiff
path: root/usr.bin/write/write.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-10-04 21:13:43 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-10-04 21:13:43 +0000
commit0ac85d799006c658a3e0f7f63bf250e0a3d5412f (patch)
tree13b5539f13528214c1a85a5114a97598c9810ec6 /usr.bin/write/write.c
parentb5691837278ca90532d19f502215508cffb6df78 (diff)
if the utmp file is (mysteriously gone) do not assume that the user is
on the specified tty; problem noted by ilja@suresec.org, ok various
Diffstat (limited to 'usr.bin/write/write.c')
-rw-r--r--usr.bin/write/write.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c
index 442abdcd23d..4eb3d5f00ae 100644
--- a/usr.bin/write/write.c
+++ b/usr.bin/write/write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write.c,v 1.23 2005/07/04 01:54:11 djm Exp $ */
+/* $OpenBSD: write.c,v 1.24 2006/10/04 21:13:42 deraadt Exp $ */
/* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */
/*
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95";
#endif
-static char *rcsid = "$OpenBSD: write.c,v 1.23 2005/07/04 01:54:11 djm Exp $";
+static char *rcsid = "$OpenBSD: write.c,v 1.24 2006/10/04 21:13:42 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -137,7 +137,7 @@ utmp_chk(char *user, char *tty)
int ufd;
if ((ufd = open(_PATH_UTMP, O_RDONLY)) < 0)
- return(0); /* ignore error, shouldn't happen anyway */
+ return(1); /* no utmp, cannot talk to users */
while (read(ufd, (char *) &u, sizeof(u)) == sizeof(u))
if (strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0 &&