From b183e05c3c8aeb9da5d0643613e3b79114c1315a Mon Sep 17 00:00:00 2001 From: Chris Morin Date: Thu, 4 Jan 2018 17:59:45 -0800 Subject: [PATCH] fs_mgr: don't log error messages when missing fstab Some devices, such as android on chromebooks, don't need an fstab. Test: Ensure no error messages are seen from fs_mgr when fstab is missing. Change-Id: Ifadb2193743a61d03f1becefd6bc81a61eb45081 --- fs_mgr/fs_mgr_fstab.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index d913af039..1c01d8c87 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -638,6 +638,7 @@ err: * frees up memory of the return value without touching a and b. */ static struct fstab *in_place_merge(struct fstab *a, struct fstab *b) { + if (!a && !b) return nullptr; if (!a) return b; if (!b) return a; @@ -755,15 +756,17 @@ struct fstab *fs_mgr_read_fstab_default() default_fstab = get_fstab_path(); } - if (default_fstab.empty()) { - LWARNING << __FUNCTION__ << "(): failed to find device default fstab"; + struct fstab* fstab = nullptr; + if (!default_fstab.empty()) { + fstab = fs_mgr_read_fstab(default_fstab.c_str()); + } else { + LINFO << __FUNCTION__ << "(): failed to find device default fstab"; } + struct fstab* fstab_dt = fs_mgr_read_fstab_dt(); + // combines fstab entries passed in from device tree with // the ones found from default_fstab file - struct fstab *fstab_dt = fs_mgr_read_fstab_dt(); - struct fstab *fstab = fs_mgr_read_fstab(default_fstab.c_str()); - return in_place_merge(fstab_dt, fstab); }