summaryrefslogtreecommitdiff
path: root/usr.bin/pkill/pkill.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-12-29 19:40:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-12-29 19:40:37 +0000
commit2a30b7a0152f42187a50f3cd27ea83d68a5e1f89 (patch)
tree08d3a092120c4853a5ace33629275101cad849f9 /usr.bin/pkill/pkill.c
parent4a1a7826895def2fba9a7e943d85b4144bc99c31 (diff)
handle snprintf -1; otto ok
Diffstat (limited to 'usr.bin/pkill/pkill.c')
-rw-r--r--usr.bin/pkill/pkill.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/pkill/pkill.c b/usr.bin/pkill/pkill.c
index ed3d8142ff1..0985a8b2e39 100644
--- a/usr.bin/pkill/pkill.c
+++ b/usr.bin/pkill/pkill.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pkill.c,v 1.6 2004/07/15 17:15:33 millert Exp $ */
+/* $OpenBSD: pkill.c,v 1.7 2004/12/29 19:40:36 deraadt Exp $ */
/* $NetBSD: pkill.c,v 1.5 2002/10/27 11:49:34 kleink Exp $ */
/*-
@@ -38,7 +38,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: pkill.c,v 1.6 2004/07/15 17:15:33 millert Exp $";
+static const char rcsid[] = "$OpenBSD: pkill.c,v 1.7 2004/12/29 19:40:36 deraadt Exp $";
#endif /* !lint */
#include <sys/types.h>
@@ -263,9 +263,13 @@ main(int argc, char **argv)
j = 0;
while (j < sizeof(buf) && *pargv != NULL) {
- j += snprintf(buf + j, sizeof(buf) - j,
+ int ret;
+
+ ret = snprintf(buf + j, sizeof(buf) - j,
pargv[1] != NULL ? "%s " : "%s",
pargv[0]);
+ if (ret > 0)
+ j += ret;
pargv++;
}