Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 716ac207 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "fastboot device: Disallow implicit conversion from unique_fd to int."...

Merge "fastboot device: Disallow implicit conversion from unique_fd to int." am: 2af05048 am: b72da0a2 am: 0961993d

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1649753

Change-Id: I61a5db1d38644a84ebd33f152b4a5fff1f3bab86
parents 44703834 0961993d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ cc_defaults {
        "-Wextra",
        "-Werror",
        "-Wvla",
        "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
    ],
    rtti: true,

+2 −2
Original line number Diff line number Diff line
@@ -392,13 +392,13 @@ static bool EnterRecovery() {

    struct sockaddr_un addr = {.sun_family = AF_UNIX};
    strncpy(addr.sun_path, "/dev/socket/recovery", sizeof(addr.sun_path) - 1);
    if (connect(sock, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
    if (connect(sock.get(), (struct sockaddr*)&addr, sizeof(addr)) < 0) {
        PLOG(ERROR) << "Couldn't connect to recovery";
        return false;
    }
    // Switch to recovery will not update the boot reason since it does not
    // require a reboot.
    auto ret = write(sock, &msg_switch_to_recovery, sizeof(msg_switch_to_recovery));
    auto ret = write(sock.get(), &msg_switch_to_recovery, sizeof(msg_switch_to_recovery));
    if (ret != sizeof(msg_switch_to_recovery)) {
        PLOG(ERROR) << "Couldn't write message to switch to recovery";
        return false;
+2 −2
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ static int usb_ffs_write(usb_handle* h, const void* data, int len) {
    int orig_len = len;
    while (len > 0) {
        int write_len = std::min(USB_FFS_BULK_SIZE, len);
        int n = write(h->bulk_in, buf, write_len);
        int n = write(h->bulk_in.get(), buf, write_len);
        if (n < 0) {
            D("ERROR: fd = %d, n = %d: %s", h->bulk_in.get(), n, strerror(errno));
            return -1;
@@ -103,7 +103,7 @@ static int usb_ffs_read(usb_handle* h, void* data, int len, bool allow_partial)
    unsigned count = 0;
    while (len > 0) {
        int read_len = std::min(USB_FFS_BULK_SIZE, len);
        int n = read(h->bulk_out, buf, read_len);
        int n = read(h->bulk_out.get(), buf, read_len);
        if (n < 0) {
            D("ERROR: fd = %d, n = %d: %s", h->bulk_out.get(), n, strerror(errno));
            return -1;
+1 −1
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ class MappedDevice final {

    ~MappedDevice();

    int fd() const { return fd_; }
    int fd() const { return fd_.get(); }
    const std::string& path() const { return path_; }

  protected: