From: sanghyeok.oh Date: Mon, 28 Oct 2019 07:23:12 +0000 (+0900) Subject: printer: print FileIdentifier X-Git-Tag: accepted/tizen/5.5/unified/20191104.111320^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cf8ea4cbc75003f797b5f6ebf7fe0c841100c7aa;p=platform%2Fcore%2Fsystem%2Flibdbuspolicy.git printer: print FileIdentifier Change-Id: Ia993cd3739f74920e3dedceeb4a58de1e967b326 Signed-off-by: sanghyeok.oh (cherry picked from commit 87cae30fd5842acc83ababd378873b3182c11f02) --- diff --git a/src/internal/print_content.hpp b/src/internal/print_content.hpp index 78f6381..2e93ea6 100644 --- a/src/internal/print_content.hpp +++ b/src/internal/print_content.hpp @@ -25,6 +25,9 @@ void use_xml_format(const bool xml); } namespace FB { +const unsigned int FB_ID_OFFSET = 4; +const unsigned int FB_ID_SIZE = 4; + std::ostream &operator<<(std::ostream &stream, const FB::File &file); } diff --git a/src/internal/storage_backend_serialized.cpp b/src/internal/storage_backend_serialized.cpp index 4859951..929f4d5 100644 --- a/src/internal/storage_backend_serialized.cpp +++ b/src/internal/storage_backend_serialized.cpp @@ -247,12 +247,20 @@ bool StorageBackendSerialized::StorageBackendSerializedImpl::init(const char *fi return err("mmap"); auto mmapGuard = transaction_guard::makeGuard([&] () { releaseMMap(); }); - if (verify) { auto verifier = flatbuffers::Verifier(mem, length); if (!FB::VerifyFileBuffer(verifier) || !FB::FileBufferHasIdentifier(mem)) { - tslog::log_error("verification of serialized data: failed\n"); - return false; + char fid[FB::FB_ID_SIZE + 1] = {0, }; + strncpy(fid, (const char *)(mem + FB::FB_ID_OFFSET), FB::FB_ID_SIZE); + + if (strcmp(fid, "LDP1") == 0) { + tslog::log_error("verification of serialized data: not available\n"); + tslog::log_error("header ID : ", FB::FileIdentifier(), "\n"); + tslog::log_error("serialized data ID : ", fid, "\n"); + } else { + tslog::log_error("verification of serialized data: failed\n"); + return false; + } } }