diff options
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 44cac4b7d..d9b1b8530 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -588,7 +588,12 @@ static Result<void> do_mount_all(const BuiltinArguments& args) { if (!ReadFstabFromFile(fstab_file, &fstab)) { return Error() << "Could not read fstab"; } - auto mount_fstab_return_code = fs_mgr_mount_all(&fstab, mount_mode); + + auto mount_fstab_return_code = + CallFunctionAndHandleProperties(fs_mgr_mount_all, &fstab, mount_mode); + if (!mount_fstab_return_code) { + return Error() << "Could not call fs_mgr_mount_all(): " << mount_fstab_return_code.error(); + } property_set(prop_name, std::to_string(t.duration().count())); if (import_rc && SelinuxGetVendorAndroidVersion() <= __ANDROID_API_Q__) { @@ -599,7 +604,7 @@ static Result<void> do_mount_all(const BuiltinArguments& args) { if (queue_event) { /* queue_fs_event will queue event based on mount_fstab return code * and return processed return code*/ - auto queue_fs_result = queue_fs_event(mount_fstab_return_code); + auto queue_fs_result = queue_fs_event(*mount_fstab_return_code); if (!queue_fs_result) { return Error() << "queue_fs_event() failed: " << queue_fs_result.error(); } @@ -615,8 +620,13 @@ static Result<void> do_umount_all(const BuiltinArguments& args) { return Error() << "Could not read fstab"; } - if (auto result = fs_mgr_umount_all(&fstab); result != 0) { - return Error() << "umount_fstab() failed " << result; + auto result = CallFunctionAndHandleProperties(fs_mgr_umount_all, &fstab); + if (!result) { + return Error() << "Could not call fs_mgr_mount_all() " << result.error(); + } + + if (*result != 0) { + return Error() << "fs_mgr_mount_all() failed: " << *result; } return {}; } @@ -627,8 +637,13 @@ static Result<void> do_swapon_all(const BuiltinArguments& args) { return Error() << "Could not read fstab '" << args[1] << "'"; } - if (!fs_mgr_swapon_all(fstab)) { - return Error() << "fs_mgr_swapon_all() failed"; + auto result = CallFunctionAndHandleProperties(fs_mgr_swapon_all, fstab); + if (!result) { + return Error() << "Could not call fs_mgr_swapon_all() " << result.error(); + } + + if (*result == 0) { + return Error() << "fs_mgr_swapon_all() failed."; } return {}; |