summaryrefslogtreecommitdiffstats
path: root/lib/plugins/CCpp.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/CCpp.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/CCpp.cpp')
-rw-r--r--lib/plugins/CCpp.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/plugins/CCpp.cpp b/lib/plugins/CCpp.cpp
index 642d97e9..ed5ab3b6 100644
--- a/lib/plugins/CCpp.cpp
+++ b/lib/plugins/CCpp.cpp
@@ -154,21 +154,14 @@ static char *install_debug_infos(const char *pDebugDumpDir, const char *debuginf
return NULL;
}
- /* With 126 debuginfos I've seen lines 9k+ chars long...
- * yet, having it truly unlimited is bad too,
- * therefore we are using LARGE, but still limited buffer.
- */
- char *buff = (char*) xmalloc(64*1024);
-
+ char *buff;
struct strbuf *buf_build_ids = strbuf_new();
-
- while (fgets(buff, 64*1024, pipeout_fp))
+ while ((buff = xmalloc_fgetline(pipeout_fp)) != NULL)
{
- strchrnul(buff, '\n')[0] = '\0';
-
if (strncmp(buff, "MISSING:", 8) == 0)
{
strbuf_append_strf(buf_build_ids, "Debuginfo absent: %s\n", buff + 8);
+ free(buff);
continue;
}
@@ -183,8 +176,8 @@ static char *install_debug_infos(const char *pDebugDumpDir, const char *debuginf
VERB1 log("%s", buff);
update_client("%s", buff);
}
+ free(buff);
}
- free(buff);
fclose(pipeout_fp);
int status = 0;