printer: print FileIdentifier 01/216801/1
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Mon, 28 Oct 2019 07:23:12 +0000 (16:23 +0900)
committersanghyeok oh <sanghyeok.oh@samsung.com>
Fri, 1 Nov 2019 08:06:45 +0000 (08:06 +0000)
Change-Id: Ia993cd3739f74920e3dedceeb4a58de1e967b326
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
(cherry picked from commit 87cae30fd5842acc83ababd378873b3182c11f02)

src/internal/print_content.hpp
src/internal/storage_backend_serialized.cpp

index 78f6381..2e93ea6 100644 (file)
@@ -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);
 }
 
index 4859951..929f4d5 100644 (file)
@@ -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;
+                       }
                }
        }