Loading minzip/DirUtil.c +2 −7 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ #include <errno.h> #include <dirent.h> #include <limits.h> #include <selinux/selinux.h> #include "DirUtil.h" Loading Loading @@ -238,7 +237,7 @@ dirUnlinkHierarchy(const char *path) int dirSetHierarchyPermissions(const char *path, int uid, int gid, int dirMode, int fileMode, const char* secontext) int uid, int gid, int dirMode, int fileMode) { struct stat st; if (lstat(path, &st)) { Loading @@ -256,10 +255,6 @@ dirSetHierarchyPermissions(const char *path, return -1; } if ((secontext != NULL) && lsetfilecon(path, secontext) && (errno != ENOTSUP)) { return -1; } /* recurse over directory components */ if (S_ISDIR(st.st_mode)) { DIR *dir = opendir(path); Loading @@ -276,7 +271,7 @@ dirSetHierarchyPermissions(const char *path, char dn[PATH_MAX]; snprintf(dn, sizeof(dn), "%s/%s", path, de->d_name); if (!dirSetHierarchyPermissions(dn, uid, gid, dirMode, fileMode, secontext)) { if (!dirSetHierarchyPermissions(dn, uid, gid, dirMode, fileMode)) { errno = 0; } else if (errno == 0) { errno = -1; Loading minzip/DirUtil.h +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ int dirUnlinkHierarchy(const char *path); * Sets directories to <dirMode> and files to <fileMode>. Skips symlinks. */ int dirSetHierarchyPermissions(const char *path, int uid, int gid, int dirMode, int fileMode, const char* secontext); int uid, int gid, int dirMode, int fileMode); #ifdef __cplusplus } Loading updater/install.c +5 −24 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include <unistd.h> #include <fcntl.h> #include <time.h> #include <selinux/selinux.h> #include "cutils/misc.h" #include "cutils/properties.h" Loading Loading @@ -522,10 +521,9 @@ Value* SymlinkFn(const char* name, State* state, int argc, Expr* argv[]) { Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) { char* result = NULL; bool recursive = (strcmp(name, "set_perm_recursive") == 0) || (strcmp(name, "set_perm2_recursive") == 0); bool has_selabel = (strcmp(name, "set_perm2") == 0) || (strcmp(name, "set_perm2_recursive") == 0); bool recursive = (strcmp(name, "set_perm_recursive") == 0); int min_args = 4 + (has_selabel ? 1 : 0) + (recursive ? 1 : 0); int min_args = 4 + (recursive ? 1 : 0); if (argc < min_args) { return ErrorAbort(state, "%s() expects %d+ args, got %d", name, min_args, argc); Loading Loading @@ -564,13 +562,8 @@ Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) { goto done; } char* secontext = NULL; if (has_selabel) { secontext = args[4]; } for (i = 4 + (has_selabel ? 1 : 0); i < argc; ++i) { dirSetHierarchyPermissions(args[i], uid, gid, dir_mode, file_mode, secontext); for (i = 4; i < argc; ++i) { dirSetHierarchyPermissions(args[i], uid, gid, dir_mode, file_mode); } } else { int mode = strtoul(args[2], &end, 0); Loading @@ -579,12 +572,7 @@ Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) { goto done; } char* secontext = NULL; if (has_selabel) { secontext = args[3]; } for (i = 3 + (has_selabel ? 1 : 0); i < argc; ++i) { for (i = 3; i < argc; ++i) { if (chown(args[i], uid, gid) < 0) { printf("%s: chown of %s to %d %d failed: %s\n", name, args[i], uid, gid, strerror(errno)); Loading @@ -595,11 +583,6 @@ Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) { name, args[i], mode, strerror(errno)); ++bad; } if (has_selabel && lsetfilecon(args[i], secontext) && (errno != ENOTSUP)) { printf("%s: lsetfilecon of %s to %s failed: %s\n", name, args[i], secontext, strerror(errno)); ++bad; } } } result = strdup(""); Loading Loading @@ -1152,8 +1135,6 @@ void RegisterInstallFunctions() { RegisterFunction("symlink", SymlinkFn); RegisterFunction("set_perm", SetPermFn); RegisterFunction("set_perm_recursive", SetPermFn); RegisterFunction("set_perm2", SetPermFn); RegisterFunction("set_perm2_recursive", SetPermFn); RegisterFunction("getprop", GetPropFn); RegisterFunction("file_getprop", FileGetPropFn); Loading Loading
minzip/DirUtil.c +2 −7 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ #include <errno.h> #include <dirent.h> #include <limits.h> #include <selinux/selinux.h> #include "DirUtil.h" Loading Loading @@ -238,7 +237,7 @@ dirUnlinkHierarchy(const char *path) int dirSetHierarchyPermissions(const char *path, int uid, int gid, int dirMode, int fileMode, const char* secontext) int uid, int gid, int dirMode, int fileMode) { struct stat st; if (lstat(path, &st)) { Loading @@ -256,10 +255,6 @@ dirSetHierarchyPermissions(const char *path, return -1; } if ((secontext != NULL) && lsetfilecon(path, secontext) && (errno != ENOTSUP)) { return -1; } /* recurse over directory components */ if (S_ISDIR(st.st_mode)) { DIR *dir = opendir(path); Loading @@ -276,7 +271,7 @@ dirSetHierarchyPermissions(const char *path, char dn[PATH_MAX]; snprintf(dn, sizeof(dn), "%s/%s", path, de->d_name); if (!dirSetHierarchyPermissions(dn, uid, gid, dirMode, fileMode, secontext)) { if (!dirSetHierarchyPermissions(dn, uid, gid, dirMode, fileMode)) { errno = 0; } else if (errno == 0) { errno = -1; Loading
minzip/DirUtil.h +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ int dirUnlinkHierarchy(const char *path); * Sets directories to <dirMode> and files to <fileMode>. Skips symlinks. */ int dirSetHierarchyPermissions(const char *path, int uid, int gid, int dirMode, int fileMode, const char* secontext); int uid, int gid, int dirMode, int fileMode); #ifdef __cplusplus } Loading
updater/install.c +5 −24 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include <unistd.h> #include <fcntl.h> #include <time.h> #include <selinux/selinux.h> #include "cutils/misc.h" #include "cutils/properties.h" Loading Loading @@ -522,10 +521,9 @@ Value* SymlinkFn(const char* name, State* state, int argc, Expr* argv[]) { Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) { char* result = NULL; bool recursive = (strcmp(name, "set_perm_recursive") == 0) || (strcmp(name, "set_perm2_recursive") == 0); bool has_selabel = (strcmp(name, "set_perm2") == 0) || (strcmp(name, "set_perm2_recursive") == 0); bool recursive = (strcmp(name, "set_perm_recursive") == 0); int min_args = 4 + (has_selabel ? 1 : 0) + (recursive ? 1 : 0); int min_args = 4 + (recursive ? 1 : 0); if (argc < min_args) { return ErrorAbort(state, "%s() expects %d+ args, got %d", name, min_args, argc); Loading Loading @@ -564,13 +562,8 @@ Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) { goto done; } char* secontext = NULL; if (has_selabel) { secontext = args[4]; } for (i = 4 + (has_selabel ? 1 : 0); i < argc; ++i) { dirSetHierarchyPermissions(args[i], uid, gid, dir_mode, file_mode, secontext); for (i = 4; i < argc; ++i) { dirSetHierarchyPermissions(args[i], uid, gid, dir_mode, file_mode); } } else { int mode = strtoul(args[2], &end, 0); Loading @@ -579,12 +572,7 @@ Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) { goto done; } char* secontext = NULL; if (has_selabel) { secontext = args[3]; } for (i = 3 + (has_selabel ? 1 : 0); i < argc; ++i) { for (i = 3; i < argc; ++i) { if (chown(args[i], uid, gid) < 0) { printf("%s: chown of %s to %d %d failed: %s\n", name, args[i], uid, gid, strerror(errno)); Loading @@ -595,11 +583,6 @@ Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) { name, args[i], mode, strerror(errno)); ++bad; } if (has_selabel && lsetfilecon(args[i], secontext) && (errno != ENOTSUP)) { printf("%s: lsetfilecon of %s to %s failed: %s\n", name, args[i], secontext, strerror(errno)); ++bad; } } } result = strdup(""); Loading Loading @@ -1152,8 +1135,6 @@ void RegisterInstallFunctions() { RegisterFunction("symlink", SymlinkFn); RegisterFunction("set_perm", SetPermFn); RegisterFunction("set_perm_recursive", SetPermFn); RegisterFunction("set_perm2", SetPermFn); RegisterFunction("set_perm2_recursive", SetPermFn); RegisterFunction("getprop", GetPropFn); RegisterFunction("file_getprop", FileGetPropFn); Loading