summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-02-03 15:28:37 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2011-02-03 15:28:37 +0100
commitb89345f000baddb1cd25212b169288531e1e326d (patch)
tree282cc0baeed2a8c770c047b1f42b55dddf73b630
parent21630f15944c343cd9fb5feead17878b0e34cc0b (diff)
downloadabrt-b89345f000baddb1cd25212b169288531e1e326d.tar.gz
abrt-b89345f000baddb1cd25212b169288531e1e326d.tar.xz
abrt-b89345f000baddb1cd25212b169288531e1e326d.zip
in bz/rhts descrition, list attachments and their sizes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--lib/Utils/make_descr.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/Utils/make_descr.cpp b/lib/Utils/make_descr.cpp
index 46d9644d..fb98cf49 100644
--- a/lib/Utils/make_descr.cpp
+++ b/lib/Utils/make_descr.cpp
@@ -93,6 +93,7 @@ string make_description_bz(const map_crash_data_t& pCrashData)
map_crash_data_t::const_iterator it = pCrashData.begin();
for (; it != pCrashData.end(); it++)
{
+ struct stat statbuf;
const string& itemname = it->first;
const string& type = it->second[CD_TYPE];
const string& content = it->second[CD_CONTENT];
@@ -134,10 +135,29 @@ string make_description_bz(const map_crash_data_t& pCrashData)
{
description += tmp;
}
- } else {
- bool was_multiline = 0;
- add_content(was_multiline, description, "Attached file", itemname.c_str());
}
+ else
+ {
+ statbuf.st_size = content.size();
+ goto add_attachment_info;
+ }
+ }
+ if (type == CD_BIN)
+ {
+ /* In many cases, it is useful to know how big binary files are
+ * (for example, helps with diagnosing bug upload problems)
+ */
+ if (stat(content.c_str(), &statbuf) != 0)
+ statbuf.st_size = (off_t) -1;
+ add_attachment_info:
+ char *descr;
+ if (statbuf.st_size >= 0)
+ descr = xasprintf("%s, %llu bytes", itemname.c_str(), (long long)statbuf.st_size);
+ else
+ descr = xstrdup(itemname.c_str());
+ bool was_multiline = 0;
+ add_content(was_multiline, description, "Attached file", descr);
+ free(descr);
}
}