summaryrefslogtreecommitdiffstats
path: root/minadbd/minadbd_services.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-01-02 18:35:59 +0100
committerTao Bao <tbao@google.com>2019-01-02 18:40:46 +0100
commit5de19e2e028964dec8090ade55971d701fdf8487 (patch)
treed3d54c1b5db72cbe108c5395209b2d0a4dc576c9 /minadbd/minadbd_services.cpp
parentMerge "Add a horizontal line at the end of the graphic menu" (diff)
downloadandroid_bootable_recovery-5de19e2e028964dec8090ade55971d701fdf8487.tar
android_bootable_recovery-5de19e2e028964dec8090ade55971d701fdf8487.tar.gz
android_bootable_recovery-5de19e2e028964dec8090ade55971d701fdf8487.tar.bz2
android_bootable_recovery-5de19e2e028964dec8090ade55971d701fdf8487.tar.lz
android_bootable_recovery-5de19e2e028964dec8090ade55971d701fdf8487.tar.xz
android_bootable_recovery-5de19e2e028964dec8090ade55971d701fdf8487.tar.zst
android_bootable_recovery-5de19e2e028964dec8090ade55971d701fdf8487.zip
Diffstat (limited to 'minadbd/minadbd_services.cpp')
-rw-r--r--minadbd/minadbd_services.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/minadbd/minadbd_services.cpp b/minadbd/minadbd_services.cpp
index e9c51da0a..9309ed749 100644
--- a/minadbd/minadbd_services.cpp
+++ b/minadbd/minadbd_services.cpp
@@ -23,6 +23,7 @@
#include <functional>
#include <string>
+#include <string_view>
#include <thread>
#include "adb.h"
@@ -49,14 +50,13 @@ static void sideload_host_service(unique_fd sfd, const std::string& args) {
exit(result == 0 ? 0 : 1);
}
-unique_fd daemon_service_to_fd(const char* name, atransport* /* transport */) {
- if (!strncmp(name, "sideload:", 9)) {
- // this exit status causes recovery to print a special error
- // message saying to use a newer adb (that supports
- // sideload-host).
+unique_fd daemon_service_to_fd(std::string_view name, atransport* /* transport */) {
+ if (name.starts_with("sideload:")) {
+ // This exit status causes recovery to print a special error message saying to use a newer adb
+ // (that supports sideload-host).
exit(3);
- } else if (!strncmp(name, "sideload-host:", 14)) {
- std::string arg(name + 14);
+ } else if (name.starts_with("sideload-host:")) {
+ std::string arg(name.substr(strlen("sideload-host:")));
return create_service_thread("sideload-host",
std::bind(sideload_host_service, std::placeholders::_1, arg));
}