From a6c1dba79559e98b2beb1cabc7b7af3661a3f88c Mon Sep 17 00:00:00 2001 From: Denis Osvald Date: Tue, 22 Nov 2016 18:09:53 +0100 Subject: [PATCH] f2fs-tools: replace noselinux patch with upstream version Signed-off-by: Denis Osvald --- utils/f2fs-tools/patches/020-no_selinux.patch | 55 ---------- ...fs-allow-to-build-without-libselinux.patch | 100 ++++++++++++++++++ 2 files changed, 100 insertions(+), 55 deletions(-) delete mode 100644 utils/f2fs-tools/patches/020-no_selinux.patch create mode 100644 utils/f2fs-tools/patches/020-sload.f2fs-allow-to-build-without-libselinux.patch diff --git a/utils/f2fs-tools/patches/020-no_selinux.patch b/utils/f2fs-tools/patches/020-no_selinux.patch deleted file mode 100644 index dcb3bd24c..000000000 --- a/utils/f2fs-tools/patches/020-no_selinux.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/configure.ac -+++ b/configure.ac -@@ -49,7 +49,7 @@ AC_PATH_PROG([LDCONFIG], [ldconfig], - - # Checks for libraries. - PKG_CHECK_MODULES([libuuid], [uuid]) --PKG_CHECK_MODULES([libselinux], [libselinux]) -+# PKG_CHECK_MODULES([libselinux], [libselinux]) - - # Checks for header files. - AC_CHECK_HEADERS([linux/fs.h fcntl.h mntent.h stdlib.h string.h \ ---- a/fsck/sload.c -+++ b/fsck/sload.c -@@ -16,10 +16,11 @@ - #include - #include - #include -+ -+#ifdef WITH_ANDROID - #include - #include - --#ifdef WITH_ANDROID - #include - #include - -@@ -110,10 +111,12 @@ static int build_directory(struct f2fs_s - handle_selabel(dentries + i, S_ISDIR(stat.st_mode), - target_out_dir); - -+#ifdef WITH_ANDROID - if (sehnd && selabel_lookup(sehnd, &dentries[i].secon, - dentries[i].path, stat.st_mode) < 0) - ERR_MSG("Cannot lookup security context for %s\n", - dentries[i].path); -+#endif - - dentries[i].pino = dir_ino; - -@@ -218,6 +221,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi, - return ret; - } - -+#ifdef WITH_ANDROID - if (sehnd) { - char *secontext = NULL; - -@@ -233,6 +237,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi, - } - free(secontext); - } -+#endif - - /* update curseg info; can update sit->types */ - move_curseg_info(sbi, SM_I(sbi)->main_blkaddr); diff --git a/utils/f2fs-tools/patches/020-sload.f2fs-allow-to-build-without-libselinux.patch b/utils/f2fs-tools/patches/020-sload.f2fs-allow-to-build-without-libselinux.patch new file mode 100644 index 000000000..eac06c9d3 --- /dev/null +++ b/utils/f2fs-tools/patches/020-sload.f2fs-allow-to-build-without-libselinux.patch @@ -0,0 +1,100 @@ +From b0a2386089fd6efade6b89094325ed8a9f8c6fff Mon Sep 17 00:00:00 2001 +From: Christian Hesse +Date: Sat, 22 Oct 2016 22:06:54 +0200 +Subject: [PATCH] sload.f2fs: allow to build without libselinux + +Some systems do not have libselinux. Allow to build sload.f2fs without +support for selinux. + +Signed-off-by: Christian Hesse +Signed-off-by: Jaegeuk Kim +--- + configure.ac | 4 +++- + fsck/sload.c | 12 +++++++++++- + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f519790..7a62328 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -54,7 +54,9 @@ AC_PATH_PROG([LDCONFIG], [ldconfig], + + # Checks for libraries. + PKG_CHECK_MODULES([libuuid], [uuid]) +-PKG_CHECK_MODULES([libselinux], [libselinux]) ++PKG_CHECK_MODULES([libselinux], [libselinux], ++ [AC_DEFINE([HAVE_LIBSELINUX], [1], [Use libselinux])], ++ [AC_MSG_NOTICE([libselinux not found])]) + + # Checks for header files. + AC_CHECK_HEADERS([linux/fs.h fcntl.h mntent.h stdlib.h string.h \ +diff --git a/fsck/sload.c b/fsck/sload.c +index ea072d1..68799c1 100644 +--- a/fsck/sload.c ++++ b/fsck/sload.c +@@ -16,8 +16,11 @@ + #include + #include + #include ++ ++#ifdef HAVE_LIBSELINUX + #include + #include ++#endif + + #ifdef WITH_ANDROID + #include +@@ -110,10 +113,12 @@ static int build_directory(struct f2fs_sb_info *sbi, const char *full_path, + handle_selabel(dentries + i, S_ISDIR(stat.st_mode), + target_out_dir); + ++#ifdef HAVE_LIBSELINUX + if (sehnd && selabel_lookup(sehnd, &dentries[i].secon, + dentries[i].path, stat.st_mode) < 0) + ERR_MSG("Cannot lookup security context for %s\n", + dentries[i].path); ++#endif + + dentries[i].pino = dir_ino; + +@@ -174,6 +179,7 @@ static int build_directory(struct f2fs_sb_info *sbi, const char *full_path, + MSG(1, "Error unknown file type\n"); + } + ++#ifdef HAVE_LIBSELINUX + if (dentries[i].secon) { + inode_set_selinux(sbi, dentries[i].ino, dentries[i].secon); + MSG(1, "File = %s \n----->SELinux context = %s\n", +@@ -184,10 +190,12 @@ static int build_directory(struct f2fs_sb_info *sbi, const char *full_path, + dentries[i].gid, dentries[i].capabilities); + } + ++ free(dentries[i].secon); ++#endif ++ + free(dentries[i].path); + free(dentries[i].full_path); + free((void *)dentries[i].name); +- free(dentries[i].secon); + } + + free(dentries); +@@ -218,6 +226,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi, const char *from_dir, + return ret; + } + ++#ifdef HAVE_LIBSELINUX + if (sehnd) { + char *secontext = NULL; + +@@ -233,6 +242,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi, const char *from_dir, + } + free(secontext); + } ++#endif + + /* update curseg info; can update sit->types */ + move_curseg_info(sbi, SM_I(sbi)->main_blkaddr); +-- +2.10.0 +