boomaga
boomaga copied to clipboard
ownership of dirs in /var/cache/boomaga
I needed the following patch to make it run:
diff --git a/src/backend/cups_backend/main.cpp b/src/backend/cups_backend/main.cpp
index b0973d0..44bb236 100644
--- a/src/backend/cups_backend/main.cpp
+++ b/src/backend/cups_backend/main.cpp
@@ -63,6 +63,20 @@ static int getmod(const string &file)
return 0;
}
+/************************************************
+ *
+ ************************************************/
+static uid_t getown(const string &file)
+{
+ struct stat fstat;
+ if (stat(file.c_str(), &fstat) == 0)
+ {
+ return fstat.st_uid;
+ }
+
+ return 0;
+}
+
/************************************************
*
@@ -113,13 +127,13 @@ static string mkUserDir(const string &baseDir, const string &user)
return "";
}
- if (chown(dir.c_str(), pwd->pw_uid, -1) != 0)
+ if (getown(dir) != pwd->pw_uid && chown(dir.c_str(), pwd->pw_uid, -1) != 0)
{
Log::error("Can't change owner on directory %s: %s", dir.c_str(), std::strerror(errno));
return "";
}
- Log::debug("User directory %s saccefully created", dir.c_str());
+ Log::debug("User directory %s succesfully created", dir.c_str());
return dir;
}