diff options
author | Karel Klic <kklic@redhat.com> | 2009-12-18 19:12:50 +0100 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2009-12-18 19:12:50 +0100 |
commit | e7661d7e411172ddad8838040ded025ad6bfbb14 (patch) | |
tree | f2451b553b4fcf959bd2bfc29172f9fb855e5fdd /lib/Plugins/SQLite3.cpp | |
parent | ce1904e24b576a7356488852a240d777717b2598 (diff) | |
parent | 46b2fb8df8d4e025f5bbdd9f53be1f658a9e82c6 (diff) | |
download | abrt-e7661d7e411172ddad8838040ded025ad6bfbb14.tar.gz abrt-e7661d7e411172ddad8838040ded025ad6bfbb14.tar.xz abrt-e7661d7e411172ddad8838040ded025ad6bfbb14.zip |
Merge branch 'master' of git://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/Plugins/SQLite3.cpp')
-rw-r--r-- | lib/Plugins/SQLite3.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/Plugins/SQLite3.cpp b/lib/Plugins/SQLite3.cpp index d95c273b..1979f246 100644 --- a/lib/Plugins/SQLite3.cpp +++ b/lib/Plugins/SQLite3.cpp @@ -198,9 +198,9 @@ static bool check_table(sqlite3 *db) if (pos != string::npos) { string tableVersion = tableName.substr(pos + 2); - if (atoi(tableVersion.c_str()) < ABRT_TABLE_VERSION) + if (xatoi_u(tableVersion.c_str()) < ABRT_TABLE_VERSION) { - update_from_old_ver(db, atoi(tableVersion.c_str())); + update_from_old_ver(db, xatoi_u(tableVersion.c_str())); } return true; } @@ -238,7 +238,18 @@ CSQLite3::CSQLite3() : CSQLite3::~CSQLite3() { - DisConnect(); + /* Paranoia. In C++, destructor will abort() if it was called while unwinding + * the stack and it throws an exception. + */ + try + { + DisConnect(); + m_sDBPath.clear(); + } + catch (...) + { + error_msg_and_die("Internal error"); + } } void CSQLite3::DisConnect() @@ -262,7 +273,7 @@ void CSQLite3::Connect() { if (ret != SQLITE_CANTOPEN) { - throw CABRTException(EXCEP_PLUGIN, "Can't open database: %s", sqlite3_errmsg(m_pDB)); + throw CABRTException(EXCEP_PLUGIN, "Can't open database '%s': %s", m_sDBPath.c_str(), sqlite3_errmsg(m_pDB)); } ret = sqlite3_open_v2(m_sDBPath.c_str(), @@ -272,7 +283,7 @@ void CSQLite3::Connect() ); if (ret != SQLITE_OK) { - throw CABRTException(EXCEP_PLUGIN, "Can't create database: %s", sqlite3_errmsg(m_pDB)); + throw CABRTException(EXCEP_PLUGIN, "Can't create database '%s': %s", m_sDBPath.c_str(), sqlite3_errmsg(m_pDB)); } } |