From ff3392b9c9471cd6d837a9ab3abe135ab2d75edf Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 22 Oct 2010 17:25:15 +0200 Subject: 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 --- lib/plugins/Logger.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/plugins/Logger.cpp') diff --git a/lib/plugins/Logger.cpp b/lib/plugins/Logger.cpp index 2985208e..8a47319f 100644 --- a/lib/plugins/Logger.cpp +++ b/lib/plugins/Logger.cpp @@ -105,10 +105,10 @@ string CLogger::Report(const map_crash_data_t& crash_data, FILE *fp = fdopen(pipefds[0], "r"); if (!fp) die_out_of_memory(); - char buf[512]; - while (fgets(buf, sizeof(buf), fp)) + char *buf; + while ((buf = xmalloc_fgets(fp)) != NULL) { - full_write_str(fd, buf); + full_write_str(fd, buf); } fclose(fp); /* this also closes pipefds[0] */ /* wait for child to actually exit, and prevent leaving a zombie behind */ -- cgit