From d6bbfbe40bac26f19f4d5d5aa3cba41708195a18 Mon Sep 17 00:00:00 2001 From: jmallett Date: Wed, 5 Jun 2002 01:58:36 +0000 Subject: 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 --- bin/ps/keyword.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bin/ps') 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; -- cgit v1.1