omap3-pandora-kernel2: update
[openpandora.oe.git] / recipes / android-tools / android-tools / disable-selinux-support.patch
1 diff --git a/extras/ext4_utils/make_ext4fs.c b/extras/ext4_utils/make_ext4fs.c
2 index b2d1426..94e92d6 100644
3 --- a/extras/ext4_utils/make_ext4fs.c
4 +++ b/extras/ext4_utils/make_ext4fs.c
5 @@ -59,9 +59,11 @@
6  
7  #else
8  
9 +#if 0
10  #include <selinux/selinux.h>
11  #include <selinux/label.h>
12  #include <selinux/android.h>
13 +#endif
14  
15  #define O_BINARY 0
16  
17 @@ -178,6 +180,7 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
18                         error("can't set android permissions - built without android support");
19  #endif
20                 }
21 +#if 0
22  #ifndef USE_MINGW
23                 if (sehnd) {
24                         if (selabel_lookup(sehnd, &dentries[i].secon, dentries[i].path, stat.st_mode) < 0) {
25 @@ -188,6 +191,7 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
26                                 printf("Labeling %s as %s\n", dentries[i].path, dentries[i].secon);
27                 }
28  #endif
29 +#endif
30  
31                 if (S_ISREG(stat.st_mode)) {
32                         dentries[i].file_type = EXT4_FT_REG_FILE;
33 @@ -229,10 +233,12 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
34                 dentries[0].file_type = EXT4_FT_DIR;
35                 dentries[0].uid = 0;
36                 dentries[0].gid = 0;
37 +#if 0
38                 if (sehnd) {
39                         if (selabel_lookup(sehnd, &dentries[0].secon, dentries[0].path, dentries[0].mode) < 0)
40                                 error("cannot lookup security context for %s", dentries[0].path);
41                 }
42 +#endif
43                 entries++;
44                 dirs++;
45         }
46 @@ -270,9 +276,11 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
47                         dentries[i].mtime);
48                 if (ret)
49                         error("failed to set permissions on %s\n", dentries[i].path);
50 +#if 0
51                 ret = inode_set_selinux(entry_inode, dentries[i].secon);
52                 if (ret)
53                         error("failed to set SELinux context on %s\n", dentries[i].path);
54 +#endif
55  
56                 free(dentries[i].path);
57                 free(dentries[i].full_path);
58 @@ -562,6 +570,7 @@ int make_ext4fs_internal(int fd, const char *_directory,
59         root_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
60         inode_set_permissions(root_inode_num, root_mode, 0, 0, 0);
61  
62 +#if 0
63  #ifndef USE_MINGW
64         if (sehnd) {
65                 char *secontext = NULL;
66 @@ -578,6 +587,7 @@ int make_ext4fs_internal(int fd, const char *_directory,
67                 freecon(secontext);
68         }
69  #endif
70 +#endif
71  
72         ext4_update_free();
73  
74 diff --git a/extras/ext4_utils/make_ext4fs_main.c b/extras/ext4_utils/make_ext4fs_main.c
75 index b6c740d..ce31764 100644
76 --- a/extras/ext4_utils/make_ext4fs_main.c
77 +++ b/extras/ext4_utils/make_ext4fs_main.c
78 @@ -29,6 +29,7 @@
79  #include <private/android_filesystem_config.h>
80  #endif
81  
82 +#if 0
83  #ifndef USE_MINGW
84  #include <selinux/selinux.h>
85  #include <selinux/label.h>
86 @@ -36,6 +37,7 @@
87  #else
88  struct selabel_handle;
89  #endif
90 +#endif
91  
92  #include "make_ext4fs.h"
93  #include "ext4_utils.h"
94 @@ -72,9 +74,11 @@ int main(int argc, char **argv)
95         int exitcode;
96         int verbose = 0;
97         struct selabel_handle *sehnd = NULL;
98 +#if 0
99  #ifndef USE_MINGW
100         struct selinux_opt seopts[] = { { SELABEL_OPT_PATH, "" } };
101  #endif
102 +#endif
103  
104         while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:S:fwzJsctv")) != -1) {
105                 switch (opt) {
106 @@ -131,6 +135,7 @@ int main(int argc, char **argv)
107                         fprintf(stderr, "Warning: -t (initialize inode tables) is deprecated\n");
108                         break;
109                 case 'S':
110 +#if 0
111  #ifndef USE_MINGW
112                         seopts[0].value = optarg;
113                         sehnd = selabel_open(SELABEL_CTX_FILE, seopts, 1);
114 @@ -139,6 +144,7 @@ int main(int argc, char **argv)
115                                 exit(EXIT_FAILURE);
116                         }
117  #endif
118 +#endif
119                         break;
120                 case 'v':
121                         verbose = 1;
122 @@ -149,6 +155,7 @@ int main(int argc, char **argv)
123                 }
124         }
125  
126 +#if 0
127  #if !defined(HOST)
128         // Use only if -S option not requested
129         if (!sehnd && mountpoint) {
130 @@ -160,6 +167,7 @@ int main(int argc, char **argv)
131                 }
132         }
133  #endif
134 +#endif
135  
136         if (wipe && sparse) {
137                 fprintf(stderr, "Cannot specifiy both wipe and sparse\n");