diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-31 00:44:38 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-31 00:44:38 +0200 |
commit | b276cf3a378b33d2d965181357dfa2e3ddc07bc7 (patch) | |
tree | db3a4702e9465352f5f62dc9c29a3b86f70f1992 /src/Daemon/CrashWatcher.cpp | |
parent | ceed068cd814059ca5207877f639c0388337eb95 (diff) | |
download | abrt-b276cf3a378b33d2d965181357dfa2e3ddc07bc7.tar.gz abrt-b276cf3a378b33d2d965181357dfa2e3ddc07bc7.tar.xz abrt-b276cf3a378b33d2d965181357dfa2e3ddc07bc7.zip |
using more x-functions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon/CrashWatcher.cpp')
-rw-r--r-- | src/Daemon/CrashWatcher.cpp | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index ae667f92..0b521c5e 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -16,25 +16,25 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - +#include "abrtlib.h" #include "CrashWatcher.h" -#include <unistd.h> +//#include <unistd.h> #include <iostream> #include <climits> #include <cstdlib> -#include <sys/types.h> -#include <pwd.h> -#include <sys/stat.h> -#include <fcntl.h> +//#include <sys/types.h> +//#include <pwd.h> +//#include <sys/stat.h> +//#include <fcntl.h> #include <cstring> #include <csignal> #include <sstream> -#include <dirent.h> +//#include <dirent.h> #include <cstring> #include "ABRTException.h" #define VAR_RUN_LOCK_FILE VAR_RUN"/abrt.lock" -#define VAR_RUN_PIDFILE VAR_RUN"/abrt.pid" +#define VAR_RUN_PIDFILE VAR_RUN"/abrt.pid" /* just a helper function template< class T > @@ -399,7 +399,6 @@ void CCrashWatcher::Debug(const std::string& pMessage) double CCrashWatcher::GetDirSize(const std::string &pPath) { double size = 0; - int stat(const char *path, struct stat *buf); struct dirent *ep; struct stat stats; DIR *dp; @@ -774,20 +773,13 @@ vector_crash_infos_t CCrashWatcher::GetCrashInfos(const std::string &pUID) uint64_t CCrashWatcher::CreateReport_t(const std::string &pUUID,const std::string &pUID) { - thread_data_t * thread_data = (thread_data_t *)calloc(1, sizeof(thread_data_t)); - if(thread_data != NULL) - { - thread_data->UUID = strdup(pUUID.c_str()); - thread_data->UID = strdup(pUID.c_str()); - thread_data->daemon = this; - if(pthread_create(&(thread_data->thread_id), NULL, create_report, (void *)thread_data) != 0) - { - throw CABRTException(EXCEP_FATAL, "CCrashWatcher::CreateReport_t(): Cannot create thread!"); - } - } - else + thread_data_t *thread_data = (thread_data_t *)xzalloc(sizeof(thread_data_t)); + thread_data->UUID = xstrdup(pUUID.c_str()); + thread_data->UID = xstrdup(pUID.c_str()); + thread_data->daemon = this; + if (pthread_create(&(thread_data->thread_id), NULL, create_report, (void *)thread_data) != 0) { - throw CABRTException(EXCEP_FATAL, "CCrashWatcher::CreateReport_t(): Cannot allocate memory!"); + throw CABRTException(EXCEP_FATAL, "CCrashWatcher::CreateReport_t(): Cannot create thread!"); } return (uint64_t) thread_data->thread_id; } |