From 7b873903656261f479628ae4cb1808253c835701 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 4 Jun 2019 01:13:14 -0700 Subject: [PATCH] scheduler: parse Android version strings of the form "(Android 9)" (existing code only worked with a.b.c and a.b) --- sched/plan_class_spec.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sched/plan_class_spec.cpp b/sched/plan_class_spec.cpp index 1332e9993d..ed8cc0aaaa 100644 --- a/sched/plan_class_spec.cpp +++ b/sched/plan_class_spec.cpp @@ -60,7 +60,7 @@ static double os_version_num(HOST h) { return 0; } -// parse "Android 4.3.1" or "Android 4.3" +// parse version# from "(Android 4.3.1)" or "(Android 4.3)" or "(Android 4)" // static int android_version_num(HOST h) { int maj, min, rel; @@ -75,6 +75,10 @@ static int android_version_num(HOST h) { if (n == 2) { return maj*10000 + min*100; } + n = sscanf(p, "%d", &maj); + if (n == 1) { + return maj*10000; + } return 0; }