From 641cfa16d6d52b78ded6d85f20c2a9bbfcf46c59 Mon Sep 17 00:00:00 2001 From: Eddie Cai Date: Tue, 18 Apr 2017 10:15:19 +0800 Subject: [PATCH] main: pack command support relative path Signed-off-by: Eddie Cai --- main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 8e8eb59..ef71e20 100644 --- a/main.cpp +++ b/main.cpp @@ -1048,7 +1048,7 @@ static inline void getName(char* path, uint16_t* dst) { else start++; end = strrchr(path, '.'); - if (!end) + if (!end || (end < start)) end = path + strlen(path); len = end - start; if (len >= MAX_NAME_LEN) @@ -1144,13 +1144,11 @@ end: static bool saveEntry(FILE* outFile, char* path, rk_entry_type type, uint16_t delay, uint32_t* offset, char* fixName, bool fix) { - printf("write:%s\n", path); uint32_t size; rk_boot_entry entry; - memset(&entry, 0, sizeof(rk_boot_entry)); printf("write:%s\n", path); - + memset(&entry, 0, sizeof(rk_boot_entry)); getName(fixName ? fixName: path, entry.name); entry.size = sizeof(rk_boot_entry); entry.type = type;