Trailing zero is always added so there is no need to have a warning about unterminated destination string. Signed-off-by: Jan Friesse <jfriesse@redhat.com> Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
@@ -254,7 +254,7 @@ static char * pid_to_name (pid_t pid, char *out_name, size_t name_len)
rest += 2;
/* copy the name */
- strncpy (out_name, name, name_len);
+ strncpy (out_name, name, name_len - 1);
out_name[name_len - 1] = '\0';
return out_name;
}