aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2023-04-17 20:55:19 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-17 20:55:19 +0000
commit3d11fff0feef44096a567998cfc6a57f0cff5a91 (patch)
tree5a68bde37dae41ca6c7e9076ab47dbfc02d20ab7
parent4fb4598922a1e36b337033d672df39c6d51721f1 (diff)
parentabfa1d892f699cadb8951eeb03efc3e69d39f405 (diff)
downloadtoybox-3d11fff0feef44096a567998cfc6a57f0cff5a91.tar.gz
Merge "Upgrade toybox to 8626a6ac7dff93bf97f754c93c3e426ee5c6b1e0" am: abfa1d892f
Original change: https://android-review.googlesource.com/c/platform/external/toybox/+/2540670 Change-Id: I006fdc85351f92acc0f32acbb927a62303bf8653 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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: