diff --git a/fastboot/Android.bp b/fastboot/Android.bp index 0ca8ba858..bf9ec90bc 100644 --- a/fastboot/Android.bp +++ b/fastboot/Android.bp @@ -127,6 +127,7 @@ cc_defaults { "-Wextra", "-Werror", "-Wvla", + "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION", ], rtti: true, diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp index b72f3fe08..0a72812c2 100644 --- a/fastboot/device/commands.cpp +++ b/fastboot/device/commands.cpp @@ -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; diff --git a/fastboot/device/usb.cpp b/fastboot/device/usb.cpp index 4bee7b20c..4115a6d28 100644 --- a/fastboot/device/usb.cpp +++ b/fastboot/device/usb.cpp @@ -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; diff --git a/fs_mgr/libfiemap/include/libfiemap/image_manager.h b/fs_mgr/libfiemap/include/libfiemap/image_manager.h index 50f4f33c2..7e305099b 100644 --- a/fs_mgr/libfiemap/include/libfiemap/image_manager.h +++ b/fs_mgr/libfiemap/include/libfiemap/image_manager.h @@ -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: