diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/daemon/MiddleWare.cpp | 22 | ||||
-rw-r--r-- | src/daemon/MiddleWare.h | 10 | ||||
-rw-r--r-- | src/lib/dump_dir.c | 14 | ||||
-rw-r--r-- | src/lib/make_descr.cpp | 1 |
4 files changed, 28 insertions, 19 deletions
diff --git a/src/daemon/MiddleWare.cpp b/src/daemon/MiddleWare.cpp index 1f849e9b..bd0e9689 100644 --- a/src/daemon/MiddleWare.cpp +++ b/src/daemon/MiddleWare.cpp @@ -37,16 +37,26 @@ CPluginManager* g_pPluginManager; /** + * Get one crash info. If getting is successful, + * then crash info is filled. + * @param dump_dir_name A dump dir containing all necessary data. + * @param pCrashData A crash info. + * @return It return results of operation. See mw_result_t. + */ +static mw_result_t FillCrashInfo(const char *crash_id, + map_crash_data_t& pCrashData); + +/** * Transforms a debugdump directory to inner crash * report form. This form is used for later reporting. - * @param pDebugDumpDir A debugdump dir containing all necessary data. + * @param dump_dir_name A debugdump dir containing all necessary data. * @param pCrashData A created crash report. */ -static bool DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& pCrashData) +static bool DebugDumpToCrashReport(const char *dump_dir_name, map_crash_data_t& pCrashData) { - VERB3 log(" DebugDumpToCrashReport('%s')", pDebugDumpDir); + VERB3 log(" DebugDumpToCrashReport('%s')", dump_dir_name); - struct dump_dir *dd = dd_opendir(pDebugDumpDir, /*flags:*/ 0); + struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); if (!dd) return false; @@ -56,7 +66,7 @@ static bool DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& if (!dd_exist(dd, *v)) { dd_close(dd); - log("Important file '%s/%s' is missing", pDebugDumpDir, *v); + log("Important file '%s/%s' is missing", dump_dir_name, *v); return false; } v++; @@ -561,7 +571,7 @@ mw_result_t SaveDebugDump(const char *dump_dir_name, return res; } -mw_result_t FillCrashInfo(const char *crash_id, +static mw_result_t FillCrashInfo(const char *crash_id, map_crash_data_t& pCrashData) { CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); diff --git a/src/daemon/MiddleWare.h b/src/daemon/MiddleWare.h index bf7a5807..90386c03 100644 --- a/src/daemon/MiddleWare.h +++ b/src/daemon/MiddleWare.h @@ -102,16 +102,6 @@ report_status_t Report(const map_crash_data_t& crash_data, */ mw_result_t SaveDebugDump(const char *pDebugDumpDir, map_crash_data_t& pCrashData); -/** - * Get one crash info. If getting is successful, - * then crash info is filled. - * @param pUUID A local UUID of a crash. - * @param pUID An UID of an user. - * @param pCrashData A crash info. - * @return It return results of operation. See mw_result_t. - */ -mw_result_t FillCrashInfo(const char *crash_id, - map_crash_data_t& pCrashData); vector_map_crash_data_t GetCrashInfos(long caller_uid); int CreateReportThread(const char* crash_id, long caller_uid, int force, const char* pSender); diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c index 3778aa85..19c49ce7 100644 --- a/src/lib/dump_dir.c +++ b/src/lib/dump_dir.c @@ -378,16 +378,26 @@ static char *load_text_file(const char *path, unsigned flags) } struct strbuf *buf_content = strbuf_new(); + int oneline = 0; int ch; while ((ch = fgetc(fp)) != EOF) { + if (ch == '\n') + oneline = (oneline << 1) | 1; if (ch == '\0') - strbuf_append_char(buf_content, ' '); - else if (isspace(ch) || (isascii(ch) && !iscntrl(ch))) + ch = ' '; + if (isspace(ch) || (isascii(ch) && !iscntrl(ch))) strbuf_append_char(buf_content, ch); } fclose(fp); + /* If file contains exactly one '\n' and it is at the end, remove it. + * This enables users to use simple "echo blah >file" in order to create + * short string items in dump dirs. + */ + if (oneline == 1 && buf_content->buf[buf_content->len - 1] == '\n') + buf_content->buf[--buf_content->len] = '\0'; + return strbuf_free_nobuf(buf_content); } diff --git a/src/lib/make_descr.cpp b/src/lib/make_descr.cpp index 79065100..33f45b9d 100644 --- a/src/lib/make_descr.cpp +++ b/src/lib/make_descr.cpp @@ -69,7 +69,6 @@ static const char *const blacklisted_items[] = { FILENAME_DUPHASH , CD_UUID , CD_INFORMALL , - FILENAME_DUPHASH , CD_DUMPDIR , CD_COUNT , CD_REPORTED , |