aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2023-04-17 15:18:41 +0000
committerElliott Hughes <enh@google.com>2023-04-17 15:18:41 +0000
commit8364e2fcc5138ad0a19d21ef9a94d567bec989cb (patch)
tree6af12f9adea761c458165f103a4e9107fc8a8dce
parent88cd220c06e2423ec36dea00f529a91a59c873b6 (diff)
parent8626a6ac7dff93bf97f754c93c3e426ee5c6b1e0 (diff)
downloadtoybox-8364e2fcc5138ad0a19d21ef9a94d567bec989cb.tar.gz
Upgrade toybox to 8626a6ac7dff93bf97f754c93c3e426ee5c6b1e0
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update toybox For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md Test: TreeHugger Change-Id: Ie6cb827cb4dc6c7816b26707a63a387d8c752cd2
-rw-r--r--METADATA4
-rw-r--r--toys/other/oneit.c15
-rw-r--r--toys/other/vmstat.c2
3 files changed, 11 insertions, 10 deletions
diff --git a/METADATA b/METADATA
index 8bed601f..70204fac 100644
--- a/METADATA
+++ b/METADATA
@@ -13,11 +13,11 @@ third_party {
type: GIT
value: "https://github.com/landley/toybox"
}
- version: "c8f758c734506d6131c2eefdb5ce2618d4b2b1d2"
+ version: "8626a6ac7dff93bf97f754c93c3e426ee5c6b1e0"
license_type: UNENCUMBERED
last_upgrade_date {
year: 2023
month: 4
- day: 14
+ day: 17
}
}
diff --git a/toys/other/oneit.c b/toys/other/oneit.c
index d154f582..c0b0c09d 100644
--- a/toys/other/oneit.c
+++ b/toys/other/oneit.c
@@ -72,14 +72,15 @@ void oneit_main(void)
// Autodetect console from sysfs if no -c
memcpy(toybuf, "/dev/", 5);
- if (!TT.c && (TT.c = readfile("/sys/class/tty/console/active", ss, 4096))) {
- // Remove null terminator, take last entry
- for (;;) {
- if (!(ss = strchr(TT.c, '\n'))) break;
- if (!ss[1]) *ss = 0;
- else TT.c = ++ss;
+ i = sizeof(toybuf)-6;
+ if (!TT.c && (TT.c = readfile("/sys/class/tty/console/active", ss, i))) {
+ // Take last entry, remove newline terminator
+ while (TT.c[i = strcspn(TT.c, " \n")]) {
+ TT.c[i++] = 0;
+ if (TT.c[i]) TT.c += i;
+ else break;
}
- // Ensure /dev prefix
+ // Ensure exactly one /dev prefix
strstart(&TT.c, "/dev/");
memmove(toybuf+5, TT.c, strlen(TT.c));
TT.c = toybuf;
diff --git a/toys/other/vmstat.c b/toys/other/vmstat.c
index ebe5399e..94502f1f 100644
--- a/toys/other/vmstat.c
+++ b/toys/other/vmstat.c
@@ -49,7 +49,7 @@ static void get_vmstat_proc(struct vmstat_proc *vmsp)
"Buffers:", "Cached:", "SwapFree:", "SwapTotal:", "SReclaimable:",
"/proc/vmstat", "pgpgin ", "pgpgout ", "pswpin ", "pswpout " };
unsigned long long *new = (void *)vmsp;
- char *p, *name = name, *file = 0;
+ char *p = 0, *name = name, *file = 0;
int i, j;
// We use vmstuff to fill out vmstat_proc as an array of long long: