summaryrefslogtreecommitdiffstats
path: root/lib/plugins/FileTransfer.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/FileTransfer.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/FileTransfer.cpp')
-rw-r--r--lib/plugins/FileTransfer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/plugins/FileTransfer.cpp b/lib/plugins/FileTransfer.cpp
index 4e4b5818..d964bc9d 100644
--- a/lib/plugins/FileTransfer.cpp
+++ b/lib/plugins/FileTransfer.cpp
@@ -280,14 +280,13 @@ void CFileTransfer::Run(const char *pActionDir, const char *pArgs, int force)
goto del_tmp_dir;
}
- char dirname[PATH_MAX];
- while (fgets(dirname, sizeof(dirname), dirlist) != NULL)
+ char *dirname;
+ while ((dirname = xmalloc_fgetline(dirlist)) != NULL)
{
- strchrnul(dirname, '\n')[0] = '\0';
string archivename = ssprintf("%s/%s-%s%s", tmpdir_name, hostname, DirBase(dirname).c_str(), m_sArchiveType.c_str());
try
{
- VERB3 log("Creating archive '%s' of dir '%s'", archivename.c_str(), dirname);
+ VERB3 log("Creating archive '%s' of dir '%s'", archivename.c_str(), dirname);
CreateArchive(archivename.c_str(), dirname);
VERB3 log("Sending archive to '%s'", m_sURL.c_str());
SendFile(m_sURL.c_str(), archivename.c_str());
@@ -298,6 +297,7 @@ void CFileTransfer::Run(const char *pActionDir, const char *pArgs, int force)
}
VERB3 log("Deleting archive '%s'", archivename.c_str());
unlink(archivename.c_str());
+ free(dirname);
}
fclose(dirlist);