diff options
| author | Benoit Goby <benoit@android.com> | 2012-08-14 15:43:46 -0700 |
|---|---|---|
| committer | Benoit Goby <benoit@android.com> | 2012-08-14 15:51:44 -0700 |
| commit | 5c8574b51210be53efbb488965db0b8591c8d1cf (patch) | |
| tree | 2bd4f3acd3754ab504f1e5d60c32e6ad99cbc557 | |
| parent | 90b80de5a7b9b4557985eb2ec21d2d82b44eb83b (diff) | |
| download | system_core-5c8574b51210be53efbb488965db0b8591c8d1cf.zip system_core-5c8574b51210be53efbb488965db0b8591c8d1cf.tar.gz system_core-5c8574b51210be53efbb488965db0b8591c8d1cf.tar.bz2 | |
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
| -rw-r--r-- | init/builtins.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/init/builtins.c b/init/builtins.c index da41b89..bb963c1 100644 --- a/init/builtins.c +++ b/init/builtins.c @@ -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; |
