summaryrefslogtreecommitdiff
path: root/usr.bin/write
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-19 17:58:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-19 17:58:23 +0000
commit84feb65f67f9dfdd4c1946c042d07d10c65d4feb (patch)
tree74d99dd3e4d3b0bef09fc5651ccd2e0809ae452b /usr.bin/write
parent14ed877776dcefece53d3ac792a4ed18ba7dd630 (diff)
mark remaining signal races which are difficult to fix, and fix a few partially
Diffstat (limited to 'usr.bin/write')
-rw-r--r--usr.bin/write/write.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c
index e5357d0deb6..60985c0ab29 100644
--- a/usr.bin/write/write.c
+++ b/usr.bin/write/write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write.c,v 1.10 1999/02/21 08:28:16 deraadt Exp $ */
+/* $OpenBSD: write.c,v 1.11 2001/01/19 17:58:21 deraadt 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.10 1999/02/21 08:28:16 deraadt Exp $";
+static char *rcsid = "$OpenBSD: write.c,v 1.11 2001/01/19 17:58:21 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -66,7 +66,7 @@ static char *rcsid = "$OpenBSD: write.c,v 1.10 1999/02/21 08:28:16 deraadt Exp $
#include <err.h>
#include <vis.h>
-void done();
+void done __P((int sig));
void do_write __P((char *, char *, uid_t));
void wr_fputs __P((char *));
void search_utmp __P((char *, char *, char *, uid_t));
@@ -127,7 +127,7 @@ main(argc, argv)
(void)fprintf(stderr, "usage: write user [tty]\n");
exit(1);
}
- done();
+ done(0);
/* NOTREACHED */
}
@@ -285,10 +285,13 @@ do_write(tty, mytty, myuid)
* done - cleanup and exit
*/
void
-done()
+done(int sig)
{
- (void)printf("EOF\r\n");
- exit(0);
+ (void)printf("EOF\r\n"); /* XXX signal race */
+ if (sig)
+ _exit(0);
+ else
+ exit(0);
}
/*