diff options
-rw-r--r-- | libps/fmt.c | 5 |
1 files changed, 4 insertions, 1 deletions
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 */ |