summaryrefslogtreecommitdiffstats
path: root/minadbd/minadbd_services.cpp
diff options
context:
space:
mode:
authorkatao <katao@xiaomi.com>2018-09-20 14:34:05 +0200
committerTao Bao <tbao@google.com>2018-09-27 18:34:01 +0200
commit77d6173714928b43750d79b6c659c056e4f827b9 (patch)
tree392db02a0b497f5ccf447a09174ada5d52616f59 /minadbd/minadbd_services.cpp
parentMerge "Show 'Enter Fastboot' menu item only if device supports fastbootd" (diff)
downloadandroid_bootable_recovery-77d6173714928b43750d79b6c659c056e4f827b9.tar
android_bootable_recovery-77d6173714928b43750d79b6c659c056e4f827b9.tar.gz
android_bootable_recovery-77d6173714928b43750d79b6c659c056e4f827b9.tar.bz2
android_bootable_recovery-77d6173714928b43750d79b6c659c056e4f827b9.tar.lz
android_bootable_recovery-77d6173714928b43750d79b6c659c056e4f827b9.tar.xz
android_bootable_recovery-77d6173714928b43750d79b6c659c056e4f827b9.tar.zst
android_bootable_recovery-77d6173714928b43750d79b6c659c056e4f827b9.zip
Diffstat (limited to '')
-rw-r--r--minadbd/minadbd_services.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/minadbd/minadbd_services.cpp b/minadbd/minadbd_services.cpp
index ab1939e92..e9c51da0a 100644
--- a/minadbd/minadbd_services.cpp
+++ b/minadbd/minadbd_services.cpp
@@ -33,19 +33,20 @@
#include "sysdeps.h"
static void sideload_host_service(unique_fd sfd, const std::string& args) {
- int file_size;
- int block_size;
- if (sscanf(args.c_str(), "%d:%d", &file_size, &block_size) != 2) {
- printf("bad sideload-host arguments: %s\n", args.c_str());
- exit(1);
- }
+ int64_t file_size;
+ int block_size;
+ if ((sscanf(args.c_str(), "%" SCNd64 ":%d", &file_size, &block_size) != 2) || file_size <= 0 ||
+ block_size <= 0) {
+ printf("bad sideload-host arguments: %s\n", args.c_str());
+ exit(1);
+ }
- printf("sideload-host file size %d block size %d\n", file_size, block_size);
+ printf("sideload-host file size %" PRId64 " block size %d\n", file_size, block_size);
- int result = run_adb_fuse(sfd, file_size, block_size);
+ int result = run_adb_fuse(sfd, file_size, block_size);
- printf("sideload_host finished\n");
- exit(result == 0 ? 0 : 1);
+ printf("sideload_host finished\n");
+ exit(result == 0 ? 0 : 1);
}
unique_fd daemon_service_to_fd(const char* name, atransport* /* transport */) {