summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-09 12:11:03 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-09 12:11:03 +0200
commit3bab9d79a01ac70a78c012eaa82dccaaa5c59ee5 (patch)
treeb22cb40eac1cff376d2cb0abb066202fe414eae3
parent5bfd6ac66529ed1976db7df0ab4853eec855e411 (diff)
downloadabrt-3bab9d79a01ac70a78c012eaa82dccaaa5c59ee5.tar.gz
abrt-3bab9d79a01ac70a78c012eaa82dccaaa5c59ee5.tar.xz
abrt-3bab9d79a01ac70a78c012eaa82dccaaa5c59ee5.zip
fix compile-time warnings.
One fix (in CCrashWatcher::GetPluginsInfo) needs closer look, others are "trivially correct" Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--inc/abrtlib.h1
-rw-r--r--lib/Plugins/Bugzilla.cpp7
-rw-r--r--lib/Plugins/CCpp.cpp12
-rw-r--r--lib/Plugins/KerneloopsReporter.cpp5
-rw-r--r--lib/Utils/xfuncs.cpp6
-rw-r--r--src/Daemon/CrashWatcher.cpp6
-rw-r--r--src/Daemon/Daemon.cpp5
-rw-r--r--src/Daemon/MiddleWare.cpp4
8 files changed, 29 insertions, 17 deletions
diff --git a/inc/abrtlib.h b/inc/abrtlib.h
index 29c8b5e8..8e3f1f4e 100644
--- a/inc/abrtlib.h
+++ b/inc/abrtlib.h
@@ -94,6 +94,7 @@ extern void xwrite(int fd, const void *buf, size_t count);
extern void xwrite_str(int fd, const char *str);
void xpipe(int filedes[2]);
+void xdup(int from);
void xdup2(int from, int to);
off_t xlseek(int fd, off_t offset, int whence);
void xsetenv(const char *key, const char *value);
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index 227f269c..6bbb75c6 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -8,11 +8,11 @@
#include <string.h>
CReporterBugzilla::CReporterBugzilla() :
- m_sBugzillaURL("https://bugzilla.redhat.com/xmlrpc.cgi"),
- m_bNoSSLVerify(false),
m_pXmlrpcTransport(NULL),
m_pXmlrpcClient(NULL),
- m_pCarriageParm(NULL)
+ m_pCarriageParm(NULL),
+ m_sBugzillaURL("https://bugzilla.redhat.com/xmlrpc.cgi"),
+ m_bNoSSLVerify(false)
{}
CReporterBugzilla::~CReporterBugzilla()
@@ -242,7 +242,6 @@ void CReporterBugzilla::AddAttachments(const std::string& pBugId, const map_cras
map_xmlrpc_params_t attachmentParams;
std::vector<xmlrpc_c::value> ret;
NSSBase64Encoder* base64;
- std::string::size_type pos;
map_crash_report_t::const_iterator it;
for (it = pCrashReport.begin(); it != pCrashReport.end(); it++)
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 6d092bf5..657e372b 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -84,11 +84,10 @@ static void InstallDebugInfos(const std::string& pPackage)
std::string packageName = pPackage.substr(0, pPackage.rfind("-", pPackage.rfind("-")-1));
char buff[1024];
int pipein[2], pipeout[2];
- struct timeval delay;
pid_t child;
- pipe(pipein); /* error check? */
- pipe(pipeout);
+ xpipe(pipein);
+ xpipe(pipeout);
child = fork();
if (child < 0)
@@ -128,6 +127,7 @@ static void InstallDebugInfos(const std::string& pPackage)
/* Was before read, does not seem to be needed
fd_set rsfd;
FD_ZERO(&rsfd);
+ struct timeval delay;
FD_SET(pipeout[0], &rsfd);
@@ -221,7 +221,6 @@ static void GetIndependentBacktrace(const std::string& pBacktrace, std::string&
int ii = 0;
std::string line;
std::string header;
- int jj = 0;
bool in_bracket = false;
bool in_quote = false;
bool in_header = false;
@@ -346,9 +345,7 @@ static pid_t ExecVP(const char* pCommand, char* const pArgs[], uid_t uid, std::s
{
int pipeout[2];
char buff[1024];
- struct timeval delay;
pid_t child;
- gid_t GID[1];
struct passwd* pw = getpwuid(uid);
if (!pw)
@@ -356,7 +353,7 @@ static pid_t ExecVP(const char* pCommand, char* const pArgs[], uid_t uid, std::s
throw CABRTException(EXCEP_PLUGIN, std::string(__func__) + ": cannot get GID for UID.");
}
- pipe(pipeout); /* error check? */
+ xpipe(pipeout);
child = fork();
if (child == -1)
{
@@ -399,6 +396,7 @@ static pid_t ExecVP(const char* pCommand, char* const pArgs[], uid_t uid, std::s
fd_set rsfd;
FD_ZERO(&rsfd);
FD_SET(pipeout[0], &rsfd);
+ struct timeval delay;
delay.tv_sec = 1;
delay.tv_usec = 0;
diff --git a/lib/Plugins/KerneloopsReporter.cpp b/lib/Plugins/KerneloopsReporter.cpp
index 64037aa0..a839b5b0 100644
--- a/lib/Plugins/KerneloopsReporter.cpp
+++ b/lib/Plugins/KerneloopsReporter.cpp
@@ -35,10 +35,11 @@
static size_t writefunction(void *ptr, size_t size, size_t nmemb, void *stream)
{
+ size *= nmemb;
+/*
char *c, *c1, *c2;
- size *= nmemb;
-/* log("received: '%*.*s'\n", (int)size, (int)size, (char*)ptr);
+ log("received: '%*.*s'\n", (int)size, (int)size, (char*)ptr);
c = (char*)xzalloc(size + 1);
memcpy(c, ptr, size);
c1 = strstr(c, "201 ");
diff --git a/lib/Utils/xfuncs.cpp b/lib/Utils/xfuncs.cpp
index 078c8045..60c2eb4f 100644
--- a/lib/Utils/xfuncs.cpp
+++ b/lib/Utils/xfuncs.cpp
@@ -88,6 +88,12 @@ void xpipe(int filedes[2])
perror_msg_and_die("can't create pipe");
}
+void xdup(int from)
+{
+ if (dup(from) < 0)
+ perror_msg_and_die("can't duplicate file descriptor");
+}
+
void xdup2(int from, int to)
{
if (dup2(from, to) != to)
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp
index cba81f14..697a9a04 100644
--- a/src/Daemon/CrashWatcher.cpp
+++ b/src/Daemon/CrashWatcher.cpp
@@ -200,6 +200,9 @@ void *CCrashWatcher::create_report(void *arg)
free(thread_data->UID);
free(thread_data->dest);
free(thread_data);
+
+ /* Bogus value. pthreads require us to return void* */
+ return NULL;
}
gboolean CCrashWatcher::cron_activation_periodic_cb(gpointer data)
@@ -885,4 +888,7 @@ vector_map_string_string_t CCrashWatcher::GetPluginsInfo()
}
Warning(e.what());
}
+ // TODO: is it right? I added it just to disable a warning...
+ // but maybe returning empty map is wrong here?
+ return vector_map_string_string_t();
}
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index b8b350c4..3a6c8fc9 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -17,6 +17,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "abrtlib.h"
#include "CrashWatcher.h"
#include "ABRTException.h"
#include <iostream>
@@ -93,8 +94,8 @@ int main(int argc, char** argv)
* Otherwise fprintf(stderr) dumps messages into random fds, etc. */
close(STDOUT_FILENO);
close(STDERR_FILENO);
- dup(0);
- dup(0);
+ xdup(0);
+ xdup(0);
}
g_pCrashWatcher = new CCrashWatcher(DEBUG_DUMPS_DIR);
if (daemonize)
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index 2a8688e7..6ebeffda 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -28,8 +28,8 @@
CMiddleWare::CMiddleWare(const std::string& pPluginsConfDir,
const std::string& pPluginsLibDir) :
m_pPluginManager(NULL),
- m_bOpenGPGCheck(true),
- m_sPluginsConfDir(pPluginsConfDir)
+ m_sPluginsConfDir(pPluginsConfDir),
+ m_bOpenGPGCheck(true)
{
m_pPluginManager = new CPluginManager(pPluginsConfDir, pPluginsLibDir);
m_pPluginManager->LoadPlugins();