diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-10-25 06:15:04 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-10-25 06:15:04 +0000 |
commit | ec10e91d6e7f7d59009ec7615496de1a62a976df (patch) | |
tree | f49b8ed2aba372ed625752091de91d39c482b5bb /usr.bin | |
parent | c7f73f2719052870bcd967d9219a1a4d80170d21 (diff) |
kill sprintf, use paths.h
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/write/write.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c index 2be00a91151..97e2fe7ef2a 100644 --- a/usr.bin/write/write.c +++ b/usr.bin/write/write.c @@ -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 @@ 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.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 <sys/types.h> @@ -59,6 +59,7 @@ static char *rcsid = "$OpenBSD: write.c,v 1.6 1996/08/26 10:28:20 deraadt Exp $" #include <signal.h> #include <time.h> #include <fcntl.h> +#include <paths.h> #include <pwd.h> #include <unistd.h> #include <utmp.h> @@ -110,7 +111,7 @@ main(argc, argv) 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 @@ term_chk(tty, msgsokP, atimeP, showerror) 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 @@ do_write(tty, mytty, myuid) 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); |