Skip to content

nshlib: one-time output uname#1640

Merged
acassis merged 1 commit intoapache:masterfrom
Gary-Hobson:uname
Mar 17, 2023
Merged

nshlib: one-time output uname#1640
acassis merged 1 commit intoapache:masterfrom
Gary-Hobson:uname

Conversation

@Gary-Hobson
Copy link
Copy Markdown
Contributor

Summary

one-time output uname,fix "uname -a > /dev/null" output format error

Impact

Testing

sim/nsh

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Comment thread nshlib/nsh_syscmds.c
/* Process each option */

first = true;
lib_memoutstream(&stream, alloca(sizeof(struct utsname)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it enough to allocate struct utsname in the extreme case? since we add more ' ' and '\n'.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is adequate, an extra 7 characters are added when using “uname -a”
But utsname->sysname is 21 (SYS_NAMELEN) bytes, only 6 bytes ("NuttX") are actually used

@acassis acassis merged commit fb0ab1b into apache:master Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants