summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-05 19:06:01 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-05 19:06:01 +0200
commit0acf7bbbbb822f1259cf1e3211e5e79724be6bf7 (patch)
tree8c7b08b5862642e872bf0d19ff1ba836c4761ef0
parent8336bbee624aa84b485e3f6b0984bce04b52e61d (diff)
downloadabrt-0acf7bbbbb822f1259cf1e3211e5e79724be6bf7.tar.gz
abrt-0acf7bbbbb822f1259cf1e3211e5e79724be6bf7.tar.xz
abrt-0acf7bbbbb822f1259cf1e3211e5e79724be6bf7.zip
CDebugDump::Create(pDir, pUID): make 2nd param uid_t, not string
-rw-r--r--lib/Plugins/KerneloopsScanner.cpp2
-rw-r--r--lib/Python/PyDebugDump.cpp10
-rw-r--r--lib/Utils/DebugDump.cpp5
-rw-r--r--lib/Utils/DebugDump.h2
-rw-r--r--src/Hooks/CCpp.cpp2
5 files changed, 10 insertions, 11 deletions
diff --git a/lib/Plugins/KerneloopsScanner.cpp b/lib/Plugins/KerneloopsScanner.cpp
index 00d5803b..f696a994 100644
--- a/lib/Plugins/KerneloopsScanner.cpp
+++ b/lib/Plugins/KerneloopsScanner.cpp
@@ -62,7 +62,7 @@ void CKerneloopsScanner::SaveOopsToDebugDump()
try
{
- debugDump.Create(path, "0");
+ debugDump.Create(path, 0);
debugDump.SaveText(FILENAME_ANALYZER, "Kerneloops");
debugDump.SaveText(FILENAME_EXECUTABLE, "kernel");
debugDump.SaveText(FILENAME_KERNEL, oops.m_sVersion);
diff --git a/lib/Python/PyDebugDump.cpp b/lib/Python/PyDebugDump.cpp
index b45b84a3..0f6de47b 100644
--- a/lib/Python/PyDebugDump.cpp
+++ b/lib/Python/PyDebugDump.cpp
@@ -73,7 +73,7 @@ static PyMethodDef ABRTUtils_functions[] = {
static int
_wrap_PyCDebugDump__tp_init(PyCDebugDump *self, PyObject *args, PyObject *kwargs)
{
- const char *keywords[] = {NULL};
+ static const char *const keywords[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
return -1;
@@ -100,10 +100,10 @@ _wrap_PyCDebugDump_Create(PyCDebugDump *self, PyObject *args, PyObject *kwargs)
{
PyObject *py_retval;
char *pFilename2;
- char *pUID2;
- const char *keywords[] = {"pFilename", "pUID", NULL};
+ int pUID2;
+ static const char *const keywords[] = {"pFilename", "pUID", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "ss", (char **) keywords, &pFilename2, &pUID2)) {
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "si", (char **) keywords, &pFilename2, &pUID2)) {
return NULL;
}
self->obj->Create(pFilename2, pUID2);
@@ -119,7 +119,7 @@ _wrap_PyCDebugDump_SaveText(PyCDebugDump *self, PyObject *args, PyObject *kwargs
PyObject *py_retval;
char *pName2;
char *pData2;
- const char *keywords[] = {"pName", "pData", NULL};
+ static const char *const keywords[] = {"pName", "pData", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "ss", (char **) keywords, &pName2, &pData2)) {
return NULL;
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index fe62280c..f63a8c6b 100644
--- a/lib/Utils/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
@@ -183,7 +183,7 @@ void CDebugDump::UnLock()
}
}
-void CDebugDump::Create(const std::string& pDir, const std::string& pUID)
+void CDebugDump::Create(const std::string& pDir, uid_t uid)
{
if (m_bOpened)
{
@@ -211,7 +211,6 @@ void CDebugDump::Create(const std::string& pDir, const std::string& pUID)
m_bOpened = false;
throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::Create(): Cannot change permissions, dir: " + pDir);
}
- uid_t uid = atoi(pUID.c_str());
struct passwd* pw = getpwuid(uid);
gid_t gid = pw ? pw->pw_gid : uid;
if (chown(m_sDebugDumpDir.c_str(), uid, gid) == -1)
@@ -221,7 +220,7 @@ void CDebugDump::Create(const std::string& pDir, const std::string& pUID)
perror_msg("can't change '%s' ownership to %u:%u", m_sDebugDumpDir.c_str(), (int)uid, (int)gid);
}
- SaveText(FILENAME_UID, pUID);
+ SaveText(FILENAME_UID, ssprintf("%u", (int)uid));
SaveKernelArchitectureRelease();
SaveTime();
}
diff --git a/lib/Utils/DebugDump.h b/lib/Utils/DebugDump.h
index 65cc7609..1bd8cc7b 100644
--- a/lib/Utils/DebugDump.h
+++ b/lib/Utils/DebugDump.h
@@ -57,7 +57,7 @@ class CDebugDump
public:
CDebugDump();
void Open(const std::string& pDir);
- void Create(const std::string& pDir, const std::string& pUID);
+ void Create(const std::string& pDir, uid_t pUID);
void Delete();
void Close();
diff --git a/src/Hooks/CCpp.cpp b/src/Hooks/CCpp.cpp
index 9cce943e..b5b576b8 100644
--- a/src/Hooks/CCpp.cpp
+++ b/src/Hooks/CCpp.cpp
@@ -175,7 +175,7 @@ int main(int argc, char** argv)
snprintf(path, sizeof(path), "%s/ccpp-%ld-%u", dddir, (long)time(NULL), (int)pid);
CDebugDump dd;
- dd.Create(path, ssprintf("%u", (int)uid));
+ dd.Create(path, uid);
dd.SaveText(FILENAME_ANALYZER, "CCpp");
dd.SaveText(FILENAME_EXECUTABLE, executable);
dd.SaveText(FILENAME_CMDLINE, cmdline);