summaryrefslogtreecommitdiff
path: root/usr.bin/lam
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/lam')
-rw-r--r--usr.bin/lam/lam.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/lam/lam.c b/usr.bin/lam/lam.c
index 67196226148..ac038512024 100644
--- a/usr.bin/lam/lam.c
+++ b/usr.bin/lam/lam.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lam.c,v 1.11 2004/07/03 21:00:37 millert Exp $ */
+/* $OpenBSD: lam.c,v 1.12 2004/12/27 23:37:37 deraadt Exp $ */
/* $NetBSD: lam.c,v 1.2 1994/11/14 20:27:42 jtc Exp $ */
/*-
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)lam.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: lam.c,v 1.11 2004/07/03 21:00:37 millert Exp $";
+static const char rcsid[] = "$OpenBSD: lam.c,v 1.12 2004/12/27 23:37:37 deraadt Exp $";
#endif /* not lint */
/*
@@ -175,7 +175,8 @@ pad(struct openfile *ip)
lp += (n < line + sizeof(line) - lp) ? n : strlen(lp);
if (ip->pad) {
n = snprintf(lp, line + sizeof(line) - lp, ip->format, "");
- lp += (n < line + sizeof(line) - lp) ? n : strlen(lp);
+ if (n > 0)
+ lp += (n < line + sizeof(line) - lp) ? n : strlen(lp);
}
return (lp);
}
@@ -206,7 +207,8 @@ gatherline(struct openfile *ip)
n = strlcpy(lp, ip->sepstring, line + sizeof(line) - lp);
lp += (n < line + sizeof(line) - lp) ? n : strlen(lp);
n = snprintf(lp, line + sizeof(line) - lp, ip->format, s);
- lp += (n < line + sizeof(line) - lp) ? n : strlen(lp);
+ if (n > 0)
+ lp += (n < line + sizeof(line) - lp) ? n : strlen(lp);
return (lp);
}