aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-11-30 14:48:31 -0800
committerRob Landley <rob@landley.net>2018-11-30 18:19:51 -0600
commit2c859218d74bf9a3b69fd54948139cf08d9881a4 (patch)
tree75ad671d8bfae7d2246b236917918b8e46514938 /toys
parent7e0a4bfc423acd4368bba32ebba94397cc5750df (diff)
downloadtoybox-2c859218d74bf9a3b69fd54948139cf08d9881a4.tar.gz
macOS: fix uname.
Don't hard-code Linux's buffer size.
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/uname.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/posix/uname.c b/toys/posix/uname.c
index 2e17d387..a1338415 100644
--- a/toys/posix/uname.c
+++ b/toys/posix/uname.c
@@ -41,12 +41,13 @@ config UNAME
void uname_main(void)
{
int i, flags = toys.optflags, needspace=0;
+ struct utsname u;
- uname((void *)toybuf);
+ uname(&u);
if (!flags) flags = FLAG_s;
for (i=0; i<5; i++) {
- char *c = toybuf+(65*i);
+ char *c = ((char *) &u)+(sizeof(u.sysname)*i);
if (flags & ((1<<i)|FLAG_a)) {
int len = strlen(c);