From 057ea6822f70ebab7d4949c8d8fb831af45ebc02 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 14 Mar 1995 03:20:23 +0000 Subject: Copy the correct number of fields when squashing. Correctly skip prefix-only fields. --- libps/fmt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libps/fmt.c b/libps/fmt.c index 3422107e..e45509d3 100644 --- a/libps/fmt.c +++ b/libps/fmt.c @@ -334,7 +334,8 @@ ps_fmt_squash(ps_fmt_t fmt, int flags) /* Shift down all following fields over this one. */ if (nfields > 0) - bcopy(field + 1, field, nfields * sizeof *field); + bcopy(field + 1, field, + (nfields - (field - fields)) * sizeof *field); if (field == fields) /* This is the first field, so move its prefix to the @@ -378,6 +379,8 @@ ps_fmt_squash(ps_fmt_t fmt, int flags) /* don't squash this field, just move to the next one */ field++; } + else + field++; } fmt->needs &= ~flags; /* we don't need any of them anymore */ -- cgit v1.2.3