Revert "Add a way to turn off unique_fd's operator int."
This reverts commit 93d63c010ae24ff58acb70216bfcb93e3c73019a.
Reason for revert: b/131312539 - All aosp-master-with-phones phones failing boot / health check.
Change-Id: Id4239f93484b7d6b8d9bcd355a59cbd40d9766e2
diff --git a/adb/client/commandline.cpp b/adb/client/commandline.cpp
index afb3ed0..43a3e5e 100644
--- a/adb/client/commandline.cpp
+++ b/adb/client/commandline.cpp
@@ -262,7 +262,7 @@
// stdout/stderr are routed independently and the remote exit code will be
// returned.
// if |callback| is non-null, stdout/stderr output will be handled by it.
-int read_and_dump(borrowed_fd fd, bool use_shell_protocol = false,
+int read_and_dump(int fd, bool use_shell_protocol = false,
StandardStreamsCallbackInterface* callback = &DEFAULT_STANDARD_STREAMS_CALLBACK) {
int exit_code = 0;
if (fd < 0) return exit_code;
@@ -305,9 +305,9 @@
}
length = protocol->data_length();
} else {
- D("read_and_dump(): pre adb_read(fd=%d)", fd.get());
+ D("read_and_dump(): pre adb_read(fd=%d)", fd);
length = adb_read(fd, raw_buffer, sizeof(raw_buffer));
- D("read_and_dump(): post adb_read(fd=%d): length=%d", fd.get(), length);
+ D("read_and_dump(): post adb_read(fd=%d): length=%d", fd, length);
if (length <= 0) {
break;
}
@@ -884,7 +884,7 @@
return -1;
}
fprintf(stderr, "adb: trying pre-KitKat sideload method...\n");
- return adb_sideload_legacy(filename, package_fd.get(), static_cast<int>(sb.st_size));
+ return adb_sideload_legacy(filename, package_fd, static_cast<int>(sb.st_size));
}
int opt = SIDELOAD_HOST_BLOCK_SIZE;
@@ -1172,14 +1172,14 @@
return send_shell_command(cmd);
}
-static void write_zeros(int bytes, borrowed_fd fd) {
+static void write_zeros(int bytes, int fd) {
int old_stdin_mode = -1;
int old_stdout_mode = -1;
std::vector<char> buf(bytes);
- D("write_zeros(%d) -> %d", bytes, fd.get());
+ D("write_zeros(%d) -> %d", bytes, fd);
- stdinout_raw_prologue(-1, fd.get(), old_stdin_mode, old_stdout_mode);
+ stdinout_raw_prologue(-1, fd, old_stdin_mode, old_stdout_mode);
if (fd == STDOUT_FILENO) {
fwrite(buf.data(), 1, bytes, stdout);
@@ -1188,7 +1188,7 @@
adb_write(fd, buf.data(), bytes);
}
- stdinout_raw_prologue(-1, fd.get(), old_stdin_mode, old_stdout_mode);
+ stdinout_raw_prologue(-1, fd, old_stdin_mode, old_stdout_mode);
D("write_zeros() finished");
}