summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgcondra@google.com <gcondra@google.com>2013-05-20 15:52:24 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-05-20 15:52:24 -0700
commitbc3d58d53bda40d788f31e6db71451c2854736cd (patch)
treec7ebdb02facca2a496941014f2ad5fac30e6968e
parent4d53ee61f68921dd08d4428b7af1ba30a806f412 (diff)
parent8c6e5f8ee923ef72e550d76e855a1d6f3df4b693 (diff)
downloadlibselinux-bc3d58d53bda40d788f31e6db71451c2854736cd.tar.gz
am 8c6e5f8e: Revert "Call lsetfilecon directly in fixcon."
* commit '8c6e5f8ee923ef72e550d76e855a1d6f3df4b693': Revert "Call lsetfilecon directly in fixcon."
-rw-r--r--src/android.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/android.c b/src/android.c
index c337650..8299f1e 100644
--- a/src/android.c
+++ b/src/android.c
@@ -705,8 +705,7 @@ bail:
static int file_requires_fixup(const char *pathname,
struct selabel_handle *sehandle_old,
- struct selabel_handle *sehandle_new,
- char **context)
+ struct selabel_handle *sehandle_new)
{
int ret;
struct stat sb;
@@ -755,10 +754,10 @@ err:
out:
if (current_context)
freecon(current_context);
+ if (new_context)
+ freecon(new_context);
if (old_context)
freecon(old_context);
- if (new_context)
- *context = new_context;
return ret;
}
@@ -767,19 +766,14 @@ static int fixcon_file(const char *pathname,
struct selabel_handle *sehandle_new)
{
int requires_fixup;
- char *new_context = NULL;
-
- requires_fixup = file_requires_fixup(pathname, sehandle_old, sehandle_new, &new_context);
-
- if (requires_fixup > 0)
- lsetfilecon(pathname, new_context);
-
- if (new_context)
- freecon(new_context);
+ requires_fixup = file_requires_fixup(pathname, sehandle_old, sehandle_new);
if (requires_fixup < 0)
return -1;
+ if (requires_fixup)
+ selinux_android_restorecon(pathname);
+
return 0;
}