diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-06-05 01:58:36 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-06-05 01:58:36 +0000 |
commit | d6bbfbe40bac26f19f4d5d5aa3cba41708195a18 (patch) | |
tree | 61084bada8043565ddf2d0323694456fa8db14f9 /bin/ps | |
parent | 6cb17fa895ac115ee28362d2d2fad8de9f5152db (diff) | |
download | FreeBSD-src-d6bbfbe40bac26f19f4d5d5aa3cba41708195a18.zip FreeBSD-src-d6bbfbe40bac26f19f4d5d5aa3cba41708195a18.tar.gz |
To comply with SUSv3, duplicate the variable contents for each given format,
so that multiple -ovar=header lines do not overwrite eachother.
This means that ps -ouser=USERNAME -ouser=WHO would now possibly print:
USERNAME WHO
juli juli
Whereas before it would be:
WHO WHO
juli juli
Diffstat (limited to 'bin/ps')
-rw-r--r-- | bin/ps/keyword.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 0e4241a..7c84691 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -246,7 +246,10 @@ parsefmt(const char *p) continue; if ((vent = malloc(sizeof(struct varent))) == NULL) err(1, NULL); - vent->var = v; + vent->var = malloc(sizeof(*vent->var)); + if (vent->var == NULL) + err(1, NULL); + memcpy(vent->var, v, sizeof(*vent->var)); vent->next = NULL; if (vhead == NULL) vhead = vtail = vent; |