cros-disks: Check nullptr return value from CreateSandboxedProcess.
Patch pihsun@'s CL 2602054 in case they don't have time to resolve merge
conflict until the break.
The CreateSandboxedProcess can return a nullptr (for example, when on a
ChromiumOS image where drivefs mounter doesn't exist). Handle this case
and return an error properly.
BUG=b:174330284
TEST=mv /opt/google/drive-file-stream /opt/google/drive-back on DUT
Log in to user account and see no cros-disks crash.
Change-Id: I955408795066c60dc22c2dd1d57af383ed33f668
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2607041
Commit-Queue: Sergei Datsenko <dats@chromium.org>
Commit-Queue: Austin Tankiang <austinct@chromium.org>
Tested-by: Sergei Datsenko <dats@chromium.org>
Auto-Submit: Sergei Datsenko <dats@chromium.org>
Reviewed-by: Austin Tankiang <austinct@chromium.org>
diff --git a/cros-disks/fuse_mounter.cc b/cros-disks/fuse_mounter.cc
index 5ac6888..efef295 100644
--- a/cros-disks/fuse_mounter.cc
+++ b/cros-disks/fuse_mounter.cc
@@ -440,6 +440,10 @@
std::vector<std::string> params,
MountErrorType* error) const {
auto sandbox = sandbox_factory_->CreateSandboxedProcess();
+ if (!sandbox) {
+ *error = MOUNT_ERROR_INTERNAL;
+ return nullptr;
+ }
*error =
ConfigureSandbox(source, target_path, std::move(params), sandbox.get());
if (*error != MOUNT_ERROR_NONE) {