Fix POSIX ACLs detection on symlinks

This commit is contained in:
Přemysl Eric Janouch 2017-07-15 14:01:26 +02:00
parent a66e5ab457
commit 53ab5290e0
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 3 additions and 7 deletions

10
sdn.cpp
View File

@ -322,13 +322,9 @@ static struct {
fun make_row (const string &filename, const struct stat &info) -> row { fun make_row (const string &filename, const struct stat &info) -> row {
row r; row r;
auto mode = decode_mode (info.st_mode); auto mode = decode_mode (info.st_mode);
if (auto acl = acl_get_file (filename.c_str (), ACL_TYPE_ACCESS)) { // This is a Linux-only extension
mode_t m; if (acl_extended_file_nofollow (filename.c_str ()) > 0)
// This is a Linux-only extension mode += L"+";
if (!acl_equiv_mode (acl, &m) && (m ^ info.st_mode) & 0777)
mode += L"+";
acl_free (acl);
}
r.cols[row::MODES] = apply_attrs (mode, 0); r.cols[row::MODES] = apply_attrs (mode, 0);
auto user = to_wstring (info.st_uid); auto user = to_wstring (info.st_uid);