Skip to content

File::setExecutable() on POSIX should set executable bit for group and other if corresponding readable bit is set #1934

@obiltschnig

Description

@obiltschnig

Proposed patch:

@@ -289,19 +289,23 @@ void FileImpl::setExecutableImpl(bool flag)
        poco_assert (!_path.empty());
 
        struct stat st;
        if (stat(_path.c_str(), &st) != 0)
                handleLastErrorImpl(_path);
        mode_t mode;
        if (flag)
        {
                mode = st.st_mode | S_IXUSR;
+               if (st.st_mode & S_IRGRP)
+                       mode |= S_IXGRP;
+               if (st.st_mode & S_IROTH)
+                       mode |= S_IXOTH;
        }
        else
        {
                mode_t wmask = S_IXUSR | S_IXGRP | S_IXOTH;
                mode = st.st_mode & ~wmask;
        }
-       if (chmod(_path.c_str(), mode) != 0) 
+       if (chmod(_path.c_str(), mode) != 0)
                handleLastErrorImpl(_path);
 }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions