1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-520. More untested changes.

Went down the list in shmkeys.h, added sane error msgs on perms
errors accessing rest of the shmsegs there.
Realized we probably do need 666 to the shmsegs.
Also deleted a little dead code that was copy-pasted everywhere.
This commit is contained in:
Patrick LeBlanc
2018-10-04 14:25:01 -05:00
parent a35009c8ee
commit 4215a47b5c
10 changed files with 17 additions and 59 deletions

View File

@ -143,32 +143,11 @@ RWLockShmImpl::RWLockShmImpl(int key, bool excl)
string keyName = BRM::ShmKeys::keyToName(key);
fKeyString = keyName;
bool rootUser = true;
//check if root-user
int user;
user = getuid();
if (user != 0)
rootUser = false;
string shmLocation = "/dev/shm/";
try
{
#if BOOST_VERSION < 104500
bi::shared_memory_object shm(bi::create_only, keyName.c_str(), bi::read_write);
#ifdef __linux__
{
string pname = shmLocation + keyName;
chmod(pname.c_str(), 0666);
}
#endif
#else
bi::permissions perms;
perms.set_unrestricted();
bi::shared_memory_object shm(bi::create_only, keyName.c_str(), bi::read_write, perms);
#endif
shm.truncate(sizeof(struct State));
fStateShm.swap(shm);
bi::mapped_region region(fStateShm, bi::read_write);
@ -190,10 +169,7 @@ RWLockShmImpl::RWLockShmImpl(int key, bool excl)
catch (bi::interprocess_exception&)
{
if (excl)
{
//don't think we can get here anymore...
throw not_excl();
}
bi::shared_memory_object shm(bi::open_only, keyName.c_str(), bi::read_write);
fStateShm.swap(shm);