summaryrefslogtreecommitdiffstats
path: root/fastboot
diff options
context:
space:
mode:
authorJames Hawkins <jhawkins@google.com>2016-02-19 11:10:30 -0800
committerJames Hawkins <jhawkins@google.com>2016-02-19 11:10:30 -0800
commit22b6f7a559e02f44442a1f5079d790884971d7f2 (patch)
treee81614a7a604616a0fff892f26b1f316664cec26 /fastboot
parentfb516c2e635677cf7f7ad8c0eee27329b245cc54 (diff)
parent0f5d443d0ccc3d3d95604b241cdd23117363f849 (diff)
downloadcore-22b6f7a559e02f44442a1f5079d790884971d7f2.tar.gz
core-22b6f7a559e02f44442a1f5079d790884971d7f2.tar.bz2
core-22b6f7a559e02f44442a1f5079d790884971d7f2.zip
resolve merge conflicts of 0f5d443d0c to nyc-dev-plus-aosp
Change-Id: I850bda0808ae17ade5bc0e667211a599d284d6e3
Diffstat (limited to 'fastboot')
-rw-r--r--fastboot/usb_linux.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/fastboot/usb_linux.cpp b/fastboot/usb_linux.cpp
index 02ffcd978..d4824fb2a 100644
--- a/fastboot/usb_linux.cpp
+++ b/fastboot/usb_linux.cpp
@@ -145,7 +145,7 @@ static int filter_usb_device(char* sysfs_name,
int in, out;
unsigned i;
unsigned e;
-
+
if (check(ptr, len, USB_DT_DEVICE, USB_DT_DEVICE_SIZE))
return -1;
dev = (struct usb_device_descriptor *)ptr;
@@ -333,15 +333,14 @@ static std::unique_ptr<usb_handle> find_usb_device(const char* base, ifc_match_f
char desc[1024];
int n, in, out, ifc;
- DIR *busdir;
struct dirent *de;
int fd;
int writable;
- busdir = opendir(base);
+ std::unique_ptr<DIR, decltype(&closedir)> busdir(opendir(base), closedir);
if (busdir == 0) return 0;
- while ((de = readdir(busdir)) && (usb == nullptr)) {
+ while ((de = readdir(busdir.get())) && (usb == nullptr)) {
if (badname(de->d_name)) continue;
if (!convert_to_devfs_name(de->d_name, devname, sizeof(devname))) {
@@ -377,7 +376,6 @@ static std::unique_ptr<usb_handle> find_usb_device(const char* base, ifc_match_f
}
}
}
- closedir(busdir);
return usb;
}