From 91149f7bc904bd9605cb314d0fe0c3a4b0f61093 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Sun, 21 Jul 2013 14:25:47 +0100 Subject: [PATCH] fs_mgr: Drop the context mount option from non-selinux builds Transitioning devices may have the context option present in the fstab, even if we're not doing selinux builds. Since we don't set or even create the contexts on those builds, this will make mount fail, and either the mountpoint ends up absent, or boot fails entirely Change-Id: Ic5cc7f5632cc3d62459dfaaf7719d662737e1641 --- fs_mgr/Android.mk | 4 ++++ fs_mgr/fs_mgr.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/fs_mgr/Android.mk b/fs_mgr/Android.mk index 7c66f6ab..48b11b69 100644 --- a/fs_mgr/Android.mk +++ b/fs_mgr/Android.mk @@ -3,6 +3,10 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) +ifeq ($(HAVE_SELINUX),true) +LOCAL_CFLAGS += -DHAVE_SELINUX +endif + LOCAL_SRC_FILES:= fs_mgr.c LOCAL_C_INCLUDES := $(LOCAL_PATH)/include diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c index 99adb81d..361cf5ca 100644 --- a/fs_mgr/fs_mgr.c +++ b/fs_mgr/fs_mgr.c @@ -147,8 +147,14 @@ static int parse_flags(char *flags, struct flag_list *fl, char **key_loc, /* It's not a known flag, so it must be a filesystem specific * option. Add it to fs_options if it was passed in. */ - strlcat(fs_options, p, fs_options_len); - strlcat(fs_options, ",", fs_options_len); +#ifndef HAVE_SELINUX + /* Drop context option from non-selinux builds */ + if (strncmp(p,"context=",8)) +#endif + { + strlcat(fs_options, p, fs_options_len); + strlcat(fs_options, ",", fs_options_len); + } } else { /* fs_options was not passed in, so if the flag is unknown * it's an error.