You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/07/02 13:25:10 UTC

[incubator-nuttx] 02/04: procfs: fix cat status error when meet long thread name

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit dbdb24e2e0edded3294c6fbd0ef7c374639200dd
Author: ligd <li...@xiaomi.com>
AuthorDate: Wed Apr 28 17:44:58 2021 +0800

    procfs: fix cat status error when meet long thread name
    
    nsh> cat /proc/3/status
    Name:       init123456789987654Type:       Task
    Group:      3
    State:      Running
    
    Change-Id: Iddef8fa1fe3a02d407244f46fa05e3f35dd7c84e
    Signed-off-by: ligd <li...@xiaomi.com>
---
 fs/procfs/fs_procfsproc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c
index 47d062a..f823543 100644
--- a/fs/procfs/fs_procfsproc.c
+++ b/fs/procfs/fs_procfsproc.c
@@ -459,8 +459,8 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile,
 #else
   name       = "<noname>";
 #endif
-  linesize   = procfs_snprintf(procfile->line, STATUS_LINELEN, "%-12s%s\n",
-                               "Name:", name);
+  linesize   = procfs_snprintf(procfile->line, STATUS_LINELEN,
+                               "%-12s%.18s\n", "Name:", name);
   copysize   = procfs_memcpy(procfile->line, linesize, buffer, remaining,
                              &offset);