summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2005-04-21 00:09:01 +0000
committerderaadt <deraadt@openbsd.org>2005-04-21 00:09:01 +0000
commitf2c97eb23d8181ad7662f64a55624985ceb710e5 (patch)
tree2b1dd2471215ac3cde87dab9bfeb3ded2be5adfb /lib/libc
parentactually error out when we would overflow by using the return value from (diff)
downloadwireguard-openbsd-f2c97eb23d8181ad7662f64a55624985ceb710e5.tar.xz
wireguard-openbsd-f2c97eb23d8181ad7662f64a55624985ceb710e5.zip
be more careful about snprintf return value; ok beck cloder
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gmon/gmon.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c
index 0dbed6eff95..81f5e761670 100644
--- a/lib/libc/gmon/gmon.c
+++ b/lib/libc/gmon/gmon.c
@@ -28,7 +28,7 @@
*/
#if !defined(lint) && defined(LIBC_SCCS)
-static char rcsid[] = "$OpenBSD: gmon.c,v 1.17 2005/03/23 19:32:09 otto Exp $";
+static char rcsid[] = "$OpenBSD: gmon.c,v 1.18 2005/04/21 00:09:01 deraadt Exp $";
#endif
#include <sys/param.h>
@@ -219,9 +219,9 @@ _mcleanup(void)
perror("mcount: gmon.log");
return;
}
- len = snprintf(dbuf, sizeof dbuf, "[mcleanup1] kcount 0x%x ssiz %d\n",
+ snprintf(dbuf, sizeof dbuf, "[mcleanup1] kcount 0x%x ssiz %d\n",
p->kcount, p->kcountsize);
- write(log, dbuf, len);
+ write(log, dbuf, strlen(dbuf));
#endif
hdr = (struct gmonhdr *)&gmonhdr;
bzero(hdr, sizeof(*hdr));
@@ -242,11 +242,11 @@ _mcleanup(void)
for (toindex = p->froms[fromindex]; toindex != 0;
toindex = p->tos[toindex].link) {
#ifdef DEBUG
- len = snprintf(dbuf, sizeof dbuf,
+ (void) snprintf(dbuf, sizeof dbuf,
"[mcleanup2] frompc 0x%x selfpc 0x%x count %d\n" ,
frompc, p->tos[toindex].selfpc,
p->tos[toindex].count);
- write(log, dbuf, len);
+ write(log, dbuf, strlen(dbuf));
#endif
rawarc.raw_frompc = frompc;
rawarc.raw_selfpc = p->tos[toindex].selfpc;