Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c8574b5 authored by Benoit Goby's avatar Benoit Goby
Browse files

init: Fix mkdir command when using ISUID or ISGID bit

On first boot, the directory is created with root:root ownership and
then chowned. chown clears the ISUID and ISGID bits, so we need to chmod
the directory again after chown.

Change-Id: I02dfe7a19a637678256b4e7cc09e6b5431e6f11e
parent 90b80de5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -322,6 +322,14 @@ int do_mkdir(int nargs, char **args)
        if (_chown(args[1], uid, gid) < 0) {
            return -errno;
        }

        /* chown may have cleared S_ISUID and S_ISGID, chmod again */
        if (mode & (S_ISUID | S_ISGID)) {
            ret = _chmod(args[1], mode);
            if (ret == -1) {
                return -errno;
            }
        }
    }

    return 0;