libc: better access on directories

This commit is contained in:
Giacomo Tesio 2017-08-28 22:59:55 +02:00
parent fe173086f7
commit 56287a4337

View File

@ -53,17 +53,14 @@ jehanne_access(const char *name, int mode)
user = jehanne_getuser();
if(jehanne_strcmp(user, db->gid) == 0){
/* check group */
tmp = db->mode & (reqmode << 3);
tmp = tmp >> 3;
tmp |= (db->mode & (reqmode << 3)) >> 3;
if(tmp != reqmode && jehanne_strcmp(user, db->uid)== 0){
/* check user */
tmp = db->mode & (reqmode << 6);
tmp = tmp >> 6;
tmp |= (db->mode & (reqmode << 6)) >> 6;
}
} else if (jehanne_strcmp(user, db->uid)== 0){
/* check user */
tmp = db->mode & (reqmode << 6);
tmp = tmp >> 6;
tmp |= (db->mode & (reqmode << 6)) >> 6;
}
}
}