summaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs/pass2.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-22 20:24:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-22 20:24:33 +0000
commit7a84eeaefb730ed882dadd3082e3d4f9c1edf250 (patch)
treefa7c5e94f9a0541e5026db02cf24056ae8b85592 /sbin/fsck_ffs/pass2.c
parent82b54f0f3f93de8d6fd760bb2514479ea752b604 (diff)
earlier asprintf diff caused malloc in signal handler. clarify the
code a bit more so that this mistake will not be done again
Diffstat (limited to 'sbin/fsck_ffs/pass2.c')
-rw-r--r--sbin/fsck_ffs/pass2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c
index 2b4b33dcfd6..4a235958288 100644
--- a/sbin/fsck_ffs/pass2.c
+++ b/sbin/fsck_ffs/pass2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass2.c,v 1.24 2006/03/12 02:28:28 deraadt Exp $ */
+/* $OpenBSD: pass2.c,v 1.25 2006/03/22 20:24:32 deraadt Exp $ */
/* $NetBSD: pass2.c,v 1.17 1996/09/27 22:45:15 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pass2.c 8.6 (Berkeley) 10/27/94";
#else
-static const char rcsid[] = "$OpenBSD: pass2.c,v 1.24 2006/03/12 02:28:28 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: pass2.c,v 1.25 2006/03/22 20:24:32 deraadt Exp $";
#endif
#endif /* not lint */
@@ -61,16 +61,16 @@ static int info_max;
static int info_pos;
static int
-pass2_info1(char *buf)
+pass2_info1(char *buf, size_t buflen)
{
- return (asprintf(&buf, "phase 2, directory %d/%d",
+ return (snprintf(buf, buflen, "phase 2, directory %d/%d",
info_pos, info_max) > 0);
}
static int
-pass2_info2(char *buf)
+pass2_info2(char *buf, size_t buflen)
{
- if (asprintf(&buf, "phase 2, parent directory %d/%d",
+ if (snprintf(buf, buflen, "phase 2, parent directory %d/%d",
info_pos, info_max) > 0)
return (strlen(buf));
return (0);