summaryrefslogtreecommitdiffstats
path: root/adb/commandline.c
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-02-24 21:26:58 -0800
committerDan Albert <danalbert@google.com>2015-02-25 15:07:57 -0800
commitcc731cc76786b6bdc58764aad9924c0d0c8d645f (patch)
tree57906636c803e1ae089c2fcf2905d82488b0ba72 /adb/commandline.c
parenta035d5003ea593322ba565df9a4f4d0dd6647acf (diff)
downloadsystem_core-cc731cc76786b6bdc58764aad9924c0d0c8d645f.zip
system_core-cc731cc76786b6bdc58764aad9924c0d0c8d645f.tar.gz
system_core-cc731cc76786b6bdc58764aad9924c0d0c8d645f.tar.bz2
Test readx/writex (now renamed).
Renamed readx/writex to ReadFdExactly/WriteFdExactly respectively. These read/write a full fixed-size buffer. If the whole buffer cannot be read/written, these functions return an error. Rename write_string to WriteStringFully. Move the TEMP_FAILURE_RETRY definition in sysdeps.h out of the !Windows section. It seems Windows won't actually interrupt a call, but it's easier to just define it than to #ifdef each call. Change-Id: Ia8ddffa2a52764a2f9a281c96c937660e002b9b9
Diffstat (limited to 'adb/commandline.c')
-rw-r--r--adb/commandline.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/adb/commandline.c b/adb/commandline.c
index 2a02c38..a8ad7bd 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -35,10 +35,10 @@
#define TRACE_TAG TRACE_ADB
#include "adb.h"
-#include "adb_client.h"
#include "adb_auth.h"
+#include "adb_client.h"
+#include "adb_io.h"
#include "file_sync_service.h"
-#include "transport.h"
static int do_cmd(transport_type ttype, char* serial, char *cmd, ...);
@@ -486,7 +486,7 @@ int adb_download_buffer(const char *service, const char *fn, const void* data, i
while(sz > 0) {
unsigned xfer = (sz > CHUNK_SIZE) ? CHUNK_SIZE : sz;
- if(writex(fd, ptr, xfer)) {
+ if(!WriteFdExactly(fd, ptr, xfer)) {
adb_status(fd);
fprintf(stderr,"* failed to write data '%s' *\n", adb_error());
return -1;
@@ -502,7 +502,7 @@ int adb_download_buffer(const char *service, const char *fn, const void* data, i
printf("\n");
}
- if(readx(fd, buf, 4)){
+ if(!ReadFdExactly(fd, buf, 4)){
fprintf(stderr,"* error reading response *\n");
adb_close(fd);
return -1;
@@ -587,7 +587,7 @@ int adb_sideload_host(const char* fn) {
int last_percent = -1;
for (;;) {
- if (readx(fd, buf, 8)) {
+ if (!ReadFdExactly(fd, buf, 8)) {
fprintf(stderr, "* failed to read command: %s\n", adb_error());
status = -1;
goto done;
@@ -614,7 +614,7 @@ int adb_sideload_host(const char* fn) {
to_write = sz - offset;
}
- if(writex(fd, start, to_write)) {
+ if(!WriteFdExactly(fd, start, to_write)) {
adb_status(fd);
fprintf(stderr,"* failed to write data '%s' *\n", adb_error());
status = -1;