Lint: Initialize variables, log variables on error
Test: th
Change-Id: I47127424de63f708f099b9884f4823366d15a838
diff --git a/payload_consumer/file_descriptor.cc b/payload_consumer/file_descriptor.cc
index da76327..ff27b73 100644
--- a/payload_consumer/file_descriptor.cc
+++ b/payload_consumer/file_descriptor.cc
@@ -77,7 +77,7 @@
uint64_t EintrSafeFileDescriptor::BlockDevSize() {
if (fd_ < 0)
return 0;
- struct stat stbuf;
+ struct stat stbuf {};
if (fstat(fd_, &stbuf) < 0) {
PLOG(ERROR) << "Error stat-ing fd " << fd_;
return 0;
@@ -102,7 +102,7 @@
// On some devices, the BLKDISCARD will actually read back as zeros, instead
// of "undefined" data. The BLKDISCARDZEROES ioctl tells whether that's the
// case, so we issue a BLKDISCARD in those cases to speed up the writes.
- unsigned int arg;
+ unsigned int arg{};
if (request == BLKZEROOUT && ioctl(fd_, BLKDISCARDZEROES, &arg) == 0 && arg)
request = BLKDISCARD;