diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2009-11-17 02:44:49 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2009-11-17 02:44:49 +0100 |
commit | 983ff51c9b6825dc0fc73b9531233d7495863718 (patch) | |
tree | b5282e1f02200949fc5244e67af969fac16db814 /libps | |
parent | 80f1aefacad4e898434962acb1f1af62eb815ef8 (diff) |
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.
Diffstat (limited to 'libps')
-rw-r--r-- | libps/fmt.c | 4 |
1 files changed, 3 insertions, 1 deletions
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'. */ |