From 5c31ffe9cdde8912d2f093e787b52c89c5b5e9b8 Mon Sep 17 00:00:00 2001 From: NIEJuhu Date: Thu, 9 Mar 2017 12:19:08 +0800 Subject: [PATCH] fs_mgr: fix errno setted by mount_with_alternatives mount_with_alternatives should set errno to match the 1st mount failure. Bug: N/A Test: run `fs_mgr -a ` and check dmesg log Change-Id: If4148d327f75c659b843e95f85568ea49c5d0180 Signed-off-by: NIEJuhu --- fs_mgr/fs_mgr.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index d0e4682e7..6c84d7332 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -563,8 +563,10 @@ static int mount_with_alternatives(struct fstab *fstab, int start_idx, int *end_ } } else { fs_stat |= FS_STAT_FULL_MOUNT_FAILED; - /* back up errno for crypto decisions */ - mount_errno = errno; + /* back up the first errno for crypto decisions */ + if (mount_errno == 0) { + mount_errno = errno; + } } log_fs_stat(fstab->recs[i].blk_device, fs_stat); }