summaryrefslogtreecommitdiffstats
path: root/lib/plugins/Bugzilla.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-10-22 17:25:15 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-10-22 17:25:15 +0200
commitff3392b9c9471cd6d837a9ab3abe135ab2d75edf (patch)
tree65595bf77f2bacc9315f20e6718356193f61cfe4 /lib/plugins/Bugzilla.cpp
parentb74cfbee13b9d2723dd48fe3e2a049fc55129699 (diff)
downloadabrt-ff3392b9c9471cd6d837a9ab3abe135ab2d75edf.tar.gz
abrt-ff3392b9c9471cd6d837a9ab3abe135ab2d75edf.tar.xz
abrt-ff3392b9c9471cd6d837a9ab3abe135ab2d75edf.zip
introduce and use xmalloc_fgets/fgetline
This fixes problems of having long lines truncated - and we do have very long lines sometimes - curl errors with HTML, list of debuginfos etc. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'lib/plugins/Bugzilla.cpp')
-rw-r--r--lib/plugins/Bugzilla.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/plugins/Bugzilla.cpp b/lib/plugins/Bugzilla.cpp
index 8d895bad..452d7a58 100644
--- a/lib/plugins/Bugzilla.cpp
+++ b/lib/plugins/Bugzilla.cpp
@@ -120,21 +120,22 @@ string CReporterBugzilla::Report(const map_crash_data_t& crash_data,
/* Consume log from stdout */
string bug_status;
- char buf[512];
- while (fgets(buf, sizeof(buf), fp))
+ char *buf;
+ while ((buf = xmalloc_fgetline(fp)) != NULL)
{
- strchrnul(buf, '\n')[0] = '\0';
if (strncmp(buf, "STATUS:", 7) == 0)
bug_status = buf + 7;
else
if (strncmp(buf, "EXCEPT:", 7) == 0)
{
+ CABRTException e(EXCEP_PLUGIN, "%s", buf + 7);
+ free(buf);
fclose(fp);
waitpid(pid, NULL, 0);
- throw CABRTException(EXCEP_PLUGIN, "%s", buf + 7);
+ throw e;
}
- else
- update_client("%s", buf);
+ update_client("%s", buf);
+ free(buf);
}
fclose(fp); /* this also closes pipefds[0] */