summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-10-11 00:20:30 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-10-11 00:20:30 +0000
commite4644f54ec33b6c94f0610e53ef27f32edf64023 (patch)
tree37d675a1a17d61dc49c0d09fcab160b74b648bd4 /sbin
parentaf7fae3d4d1a74baf13a498e2ed1a1bceee63f2a (diff)
Prefer dprintf() over snprintf()+write()
ok beck@ deraadt@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/newfs/mkfs.c6
-rw-r--r--sbin/ping/ping.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 6452f8ab1cc..6ab3b55bfc8 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkfs.c,v 1.92 2015/08/20 22:02:21 deraadt Exp $ */
+/* $OpenBSD: mkfs.c,v 1.93 2015/10/11 00:20:29 guenther Exp $ */
/* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */
/*
@@ -154,11 +154,9 @@ void
siginfo(int sig)
{
int save_errno = errno;
- char buf[128];
- snprintf(buf, sizeof(buf), "%s: initializing cg %ld/%d\n",
+ dprintf(STDERR_FILENO, "%s: initializing cg %ld/%d\n",
cur_fsys, (long)cur_cylno, sblock.fs_ncg);
- write(STDERR_FILENO, buf, strlen(buf));
errno = save_errno;
}
#endif
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 57af30bf1be..9b5b7d4e0b4 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.127 2015/10/09 01:37:06 deraadt Exp $ */
+/* $OpenBSD: ping.c,v 1.128 2015/10/11 00:20:29 guenther Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
@@ -623,7 +623,6 @@ void
pinger(void)
{
struct icmp *icp;
- char buf[8192];
int cc, i;
u_char *packet = outpack;
@@ -688,9 +687,8 @@ pinger(void)
if (i < 0 || i != cc) {
if (i < 0)
perror("ping: sendto");
- snprintf(buf, sizeof buf, "ping: wrote %s %d chars, ret=%d\n",
+ dprintf(STDOUT_FILENO, "ping: wrote %s %d chars, ret=%d\n",
hostname, cc, i);
- write(STDOUT_FILENO, buf, strlen(buf));
}
if (!(options & F_QUIET) && options & F_FLOOD)
(void)write(STDOUT_FILENO, &DOT, 1);