diff options
author | Yi Jin <jinyithu@google.com> | 2017-10-16 14:42:50 -0700 |
---|---|---|
committer | Yi Jin <jinyithu@google.com> | 2017-10-18 13:17:32 -0700 |
commit | 22769e0123340f49370ea4748aff71a1b84dc863 (patch) | |
tree | a047713fb7035d3e393246465ccc0e7bc7c6f5c2 /tools/incident_report | |
parent | 05d0f4c1a364f50e01ee3d10b6520596c57d2037 (diff) |
Fixed several bugs found for incidentd
1. Add logging for proto can't be parsed by incident_report
2. Close opened file descriptor of incident report request!
3. Fix invalid syntax of auto-gen section_list.cpp
Bug: 67849582
Test: manually run incident and checks /proc/<its pid>/fd
Change-Id: I38e6ac28de09aca6243ad536ed41d8059e08ba24
Diffstat (limited to 'tools/incident_report')
-rw-r--r-- | tools/incident_report/main.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/incident_report/main.cpp b/tools/incident_report/main.cpp index cc252649da96..bd1b973c7bdf 100644 --- a/tools/incident_report/main.cpp +++ b/tools/incident_report/main.cpp @@ -45,8 +45,9 @@ static bool read_length_delimited(CodedInputStream* in, uint32 fieldId, Descriptor const* descriptor, GenericMessage* message) { - uint32 size; + uint32_t size; if (!in->ReadVarint32(&size)) { + fprintf(stderr, "Fail to read size of %s\n", descriptor->name().c_str()); return false; } @@ -68,6 +69,9 @@ read_length_delimited(CodedInputStream* in, uint32 fieldId, Descriptor const* de message->addString(fieldId, str); return true; } else { + fprintf(stderr, "Fail to read string of field %s, expect size %d, read %lu\n", + field->full_name().c_str(), size, str.size()); + fprintf(stderr, "String read \"%s\"\n", str.c_str()); return false; } } else if (type == FieldDescriptor::TYPE_BYTES) { |