diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-04-16 17:37:26 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-04-16 17:37:26 +0000 |
commit | 306d2c85cf362a9041b81c448dd0d093d1b05585 (patch) | |
tree | 8ea1d711f1f91e344aeb42783ea780f3acf75b69 /sbin/fsck_ffs/pass2.c | |
parent | 9ece674622a863eb59f1b51f503bf9e5cea2b24f (diff) |
while snprintf and strlcpy and strlcat have this nice >buflen API (and the
-1 mess as well), it is probably not wise to make other functions do the same
thing. make them return strlen(). ok uwe marco
Diffstat (limited to 'sbin/fsck_ffs/pass2.c')
-rw-r--r-- | sbin/fsck_ffs/pass2.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c index 83e2a14443c..7cc10c245f3 100644 --- a/sbin/fsck_ffs/pass2.c +++ b/sbin/fsck_ffs/pass2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pass2.c,v 1.19 2003/10/11 01:43:45 tedu Exp $ */ +/* $OpenBSD: pass2.c,v 1.20 2005/04/16 17:37:25 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.19 2003/10/11 01:43:45 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: pass2.c,v 1.20 2005/04/16 17:37:25 deraadt Exp $"; #endif #endif /* not lint */ @@ -63,15 +63,19 @@ static int info_pos; static int pass2_info1(char *buf, int buflen) { - return snprintf(buf, buflen, "phase 2, directory %d/%d", - info_pos, info_max); + if (snprintf(buf, buflen, "phase 2, directory %d/%d", + info_pos, info_max) > 0) + return (strlen(buf)); + return (0); } static int pass2_info2(char *buf, int buflen) { - return snprintf(buf, buflen, "phase 2, parent directory %d/%d", - info_pos, info_max); + if (snprintf(buf, buflen, "phase 2, parent directory %d/%d", + info_pos, info_max) > 0) + return (strlen(buf)); + return (0); } void |