From 983ff51c9b6825dc0fc73b9531233d7495863718 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 17 Nov 2009 02:44:49 +0100 Subject: Fix ps -o command and such hang * libps/fmt.c (_fmt_create): Put NUL terminator only when there is room for it. When there is not it is there already anyway. --- libps/fmt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libps/fmt.c') diff --git a/libps/fmt.c b/libps/fmt.c index eae08ffe..3a47338a 100644 --- a/libps/fmt.c +++ b/libps/fmt.c @@ -194,7 +194,9 @@ _fmt_create (char *src, int posix, struct ps_fmt_specs *fmt_specs, while (*src != '\0' && *src != stop) src++; } - *src++ = '\0'; /* NUL terminhate NAME. */ + + if (*src) + *src++ = '\0'; /* NUL terminate NAME. */ } else /* A gnu-style field spec: `NAME' or `NAME:TITLE'. */ -- cgit v1.2.3