diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-05 17:43:44 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-05 17:43:44 +0200 |
commit | fd398978422b244989a8d32dc0d74d0c4cd04fbd (patch) | |
tree | e2c6730e2cbfcc72370b61d5aca64bf98eba8832 /lib/Utils/DebugDump.cpp | |
parent | 78a4521d6b1881f9438fbb72ad9b42374b5d3834 (diff) | |
download | abrt-fd398978422b244989a8d32dc0d74d0c4cd04fbd.tar.gz abrt-fd398978422b244989a8d32dc0d74d0c4cd04fbd.tar.xz abrt-fd398978422b244989a8d32dc0d74d0c4cd04fbd.zip |
do not abort if chown fails, just warn
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils/DebugDump.cpp')
-rw-r--r-- | lib/Utils/DebugDump.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp index 3297579b..fe62280c 100644 --- a/lib/Utils/DebugDump.cpp +++ b/lib/Utils/DebugDump.cpp @@ -19,25 +19,15 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "abrtlib.h" #include "DebugDump.h" #include "ABRTException.h" #include <fstream> #include <iostream> #include <sstream> #include <cerrno> -#include <sys/types.h> -#include <sys/stat.h> -#include <dirent.h> #include <sys/utsname.h> -#include <limits.h> -#include <fcntl.h> -#include <ctype.h> -#include <time.h> -#include <unistd.h> #include <magic.h> -#include <string.h> -#include <pwd.h> -#include <stdlib.h> #include "CommLayerInner.h" // BUG? in C/C++, compiler may assume that function address is never NULL @@ -223,11 +213,12 @@ void CDebugDump::Create(const std::string& pDir, const std::string& pUID) } uid_t uid = atoi(pUID.c_str()); struct passwd* pw = getpwuid(uid); - if (chown(m_sDebugDumpDir.c_str(), uid, pw ? pw->pw_gid : uid) == -1) + gid_t gid = pw ? pw->pw_gid : uid; + if (chown(m_sDebugDumpDir.c_str(), uid, gid) == -1) { - UnLock(); - m_bOpened = false; - throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::Create(): Cannot change ownership, dir: " + pDir); + /* if /var/cache/abrt is writable by all, _aborting_ here is not useful */ + /* let's just warn */ + perror_msg("can't change '%s' ownership to %u:%u", m_sDebugDumpDir.c_str(), (int)uid, (int)gid); } SaveText(FILENAME_UID, pUID); @@ -239,7 +230,7 @@ static void DeleteFileDir(const std::string& pDir) { DIR *dir = opendir(pDir.c_str()); if (!dir) - return; + return; struct dirent *dent; while ((dent = readdir(dir)) != NULL) |