summaryrefslogtreecommitdiff
path: root/usr.bin/write
diff options
context:
space:
mode:
authorjasoni <jasoni@cvs.openbsd.org>2001-06-27 06:53:56 +0000
committerjasoni <jasoni@cvs.openbsd.org>2001-06-27 06:53:56 +0000
commita8559962f98058a8039efc6dc1db817c2895dccb (patch)
treee3fa87d6a72cf98096066881ad5b9e2758b84969 /usr.bin/write
parent17cc5dbba19bbbbeb9361149e56ee11dbc22da68 (diff)
-Wall cleanup; ok millert@
Diffstat (limited to 'usr.bin/write')
-rw-r--r--usr.bin/write/write.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c
index 60985c0ab29..81c0f647cb6 100644
--- a/usr.bin/write/write.c
+++ b/usr.bin/write/write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write.c,v 1.11 2001/01/19 17:58:21 deraadt Exp $ */
+/* $OpenBSD: write.c,v 1.12 2001/06/27 06:53:55 jasoni Exp $ */
/* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */
/*
@@ -47,7 +47,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.11 2001/01/19 17:58:21 deraadt Exp $";
+static char *rcsid = "$OpenBSD: write.c,v 1.12 2001/06/27 06:53:55 jasoni Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -95,7 +95,7 @@ main(argc, argv)
errx(1, "can't find your tty");
if (!(mytty = ttyname(myttyfd)))
errx(1, "can't find your tty's name");
- if (cp = strrchr(mytty, '/'))
+ if ((cp = strrchr(mytty, '/')))
mytty = cp + 1;
if (term_chk(mytty, &msgsok, &atime, 1))
exit(1);
@@ -128,7 +128,9 @@ main(argc, argv)
exit(1);
}
done(0);
+
/* NOTREACHED */
+ return (0);
}
/*
@@ -255,11 +257,12 @@ do_write(tty, mytty, myuid)
char path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512];
/* Determine our login name before the we reopen() stdout */
- if ((login = getlogin()) == NULL)
- if (pwd = getpwuid(myuid))
+ if ((login = getlogin()) == NULL) {
+ if ((pwd = getpwuid(myuid)))
login = pwd->pw_name;
else
login = "???";
+ }
(void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);
if ((freopen(path, "w", stdout)) == NULL)