=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/write/write.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- src/usr.bin/write/write.c 1996/08/26 10:28:20 1.6 +++ src/usr.bin/write/write.c 1996/10/25 06:15:03 1.7 @@ -1,4 +1,4 @@ -/* $OpenBSD: write.c,v 1.6 1996/08/26 10:28:20 deraadt Exp $ */ +/* $OpenBSD: write.c,v 1.7 1996/10/25 06:15:03 downsj Exp $ */ /* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */ /* @@ -47,7 +47,7 @@ #if 0 static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95"; #endif -static char *rcsid = "$OpenBSD: write.c,v 1.6 1996/08/26 10:28:20 deraadt Exp $"; +static char *rcsid = "$OpenBSD: write.c,v 1.7 1996/10/25 06:15:03 downsj Exp $"; #endif /* not lint */ #include @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -110,7 +111,7 @@ do_write(tty, mytty, myuid); break; case 3: - if (!strncmp(argv[2], "/dev/", 5)) + if (!strncmp(argv[2], _PATH_DEV, strlen(_PATH_DEV))) argv[2] += 5; if (utmp_chk(argv[1], argv[2])) errx(1, "%s is not logged in on %s", @@ -229,7 +230,7 @@ struct stat s; char path[MAXPATHLEN]; - (void)sprintf(path, "/dev/%s", tty); + (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty); if (stat(path, &s) < 0) { if (showerror) warn("%s", path); @@ -260,7 +261,7 @@ else login = "???"; - (void)sprintf(path, "/dev/%s", tty); + (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty); if ((freopen(path, "w", stdout)) == NULL) err(1, "%s", path);