summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2012-12-18 15:27:26 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-12-18 15:27:26 -0800
commit917e120f736f95292a40b6c7da9940d6369955e1 (patch)
tree1accede5e43bb6ad38058079de2f839ad5bd22f3
parentf69ebaba431e98a70c2151a83c4b102de89885aa (diff)
parentc04808a532b0421fded05eecf5d843c45b7eb407 (diff)
downloadextras-jb-mr1.1-release.tar.gz
am c04808a5: make_ext4fs: fix sepolicy lookup for lost+foundandroid-cts-4.2_r2android-4.2.2_r1.2android-4.2.2_r1.1android-4.2.2_r1jb-mr1.1-release
* commit 'c04808a532b0421fded05eecf5d843c45b7eb407': make_ext4fs: fix sepolicy lookup for lost+found
-rw-r--r--ext4_utils/make_ext4fs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index 85dad4e7..db6fbe6f 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -215,7 +215,7 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
dentries = tmp;
dentries[0].filename = strdup("lost+found");
- dentries[0].path = strdup("/lost+found");
+ asprintf(&dentries[0].path, "%s/lost+found", dir_path);
dentries[0].full_path = NULL;
dentries[0].size = 0;
dentries[0].mode = S_IRWXU;
@@ -223,9 +223,13 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
dentries[0].uid = 0;
dentries[0].gid = 0;
#ifdef HAVE_SELINUX
- if (sehnd)
- if (selabel_lookup(sehnd, &dentries[0].secon, "lost+found", dentries[0].mode) < 0)
- error("cannot lookup security context for /lost+found");
+ if (sehnd) {
+ char *sepath = NULL;
+ asprintf(&sepath, "/%s", dentries[0].path);
+ if (selabel_lookup(sehnd, &dentries[0].secon, sepath, dentries[0].mode) < 0)
+ error("cannot lookup security context for %s", dentries[0].path);
+ free(sepath);
+ }
#endif
entries++;
dirs++;