Fix logspam when user removed before CE storage prepared
Due to frameworks/base commit 5c65b1ee1023 ("Don't prepare CE storage on user creation") (http://ag/20241697), removing a user immediately after creating it causes the user's directories to be destroyed before CE storage was prepared. Functionally this works fine; however, it causes some error messages to be spammed to the log because 'vold_prepare_subdirs destroy' doesn't like that /data/misc_ce/$userId and /data/vendor_ce/$userId don't exist. vold_prepare_subdirs logs two error messages itself, but it also exits with a failure status, which bubbles up and causes a Slog.wtf with a stack trace in StorageManagerService. Fix this by making rmrf_contents() simply return true if the directory doesn't exist. Bug: 232452368 Test: 'pm create-user 10 && pm remove-user 10' and check logcat Change-Id: I867a915f4b25e1a5f0603fbd84680b673ff5eb96
This commit is contained in:
parent
eee1149800
commit
629c63414e
1 changed files with 3 additions and 0 deletions
|
@ -114,6 +114,9 @@ static bool prepare_dir(struct selabel_handle* sehandle, mode_t mode, uid_t uid,
|
|||
static bool rmrf_contents(const std::string& path) {
|
||||
auto dirp = std::unique_ptr<DIR, int (*)(DIR*)>(opendir(path.c_str()), closedir);
|
||||
if (!dirp) {
|
||||
if (errno == ENOENT) {
|
||||
return true;
|
||||
}
|
||||
PLOG(ERROR) << "Unable to open directory: " << path;
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue