aboutsummaryrefslogtreecommitdiffstats
path: root/updater/install.c
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2013-09-11 11:37:10 -0700
committerNick Kralevich <nnk@google.com>2013-09-17 10:20:45 -0700
commit46ab1b6138bf911120280f1095ff9479dceee3df (patch)
treefa6091faa4986f4528859c6c234b4b62a80d4f9e /updater/install.c
parent1306a7effafab77cf2769091619518c2ab263ee8 (diff)
downloadbootable_recovery-46ab1b6138bf911120280f1095ff9479dceee3df.zip
bootable_recovery-46ab1b6138bf911120280f1095ff9479dceee3df.tar.gz
bootable_recovery-46ab1b6138bf911120280f1095ff9479dceee3df.tar.bz2
updater: Delete dead code
set_perm and set_perm_recursive are no longer used. Delete. (cherry picked from commit 08ef9a957027183dcf55e432441e8fb0d5299aba) Change-Id: I1bcc90ae19af9df4f0705496c5876987159f75ac
Diffstat (limited to 'updater/install.c')
-rw-r--r--updater/install.c87
1 files changed, 0 insertions, 87 deletions
diff --git a/updater/install.c b/updater/install.c
index 0a85945..061aa7b 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -524,88 +524,6 @@ Value* SymlinkFn(const char* name, State* state, int argc, Expr* argv[]) {
return StringValue(strdup(""));
}
-
-Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) {
- char* result = NULL;
- bool recursive = (strcmp(name, "set_perm_recursive") == 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);
- }
-
- char** args = ReadVarArgs(state, argc, argv);
- if (args == NULL) return NULL;
-
- char* end;
- int i;
- int bad = 0;
-
- int uid = strtoul(args[0], &end, 0);
- if (*end != '\0' || args[0][0] == 0) {
- ErrorAbort(state, "%s: \"%s\" not a valid uid", name, args[0]);
- goto done;
- }
-
- int gid = strtoul(args[1], &end, 0);
- if (*end != '\0' || args[1][0] == 0) {
- ErrorAbort(state, "%s: \"%s\" not a valid gid", name, args[1]);
- goto done;
- }
-
- if (recursive) {
- int dir_mode = strtoul(args[2], &end, 0);
- if (*end != '\0' || args[2][0] == 0) {
- ErrorAbort(state, "%s: \"%s\" not a valid dirmode", name, args[2]);
- goto done;
- }
-
- int file_mode = strtoul(args[3], &end, 0);
- if (*end != '\0' || args[3][0] == 0) {
- ErrorAbort(state, "%s: \"%s\" not a valid filemode",
- name, args[3]);
- goto done;
- }
-
- for (i = 4; i < argc; ++i) {
- dirSetHierarchyPermissions(args[i], uid, gid, dir_mode, file_mode);
- }
- } else {
- int mode = strtoul(args[2], &end, 0);
- if (*end != '\0' || args[2][0] == 0) {
- ErrorAbort(state, "%s: \"%s\" not a valid mode", name, args[2]);
- goto done;
- }
-
- 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));
- ++bad;
- }
- if (chmod(args[i], mode) < 0) {
- printf("%s: chmod of %s to %o failed: %s\n",
- name, args[i], mode, strerror(errno));
- ++bad;
- }
- }
- }
- result = strdup("");
-
-done:
- for (i = 0; i < argc; ++i) {
- free(args[i]);
- }
- free(args);
-
- if (bad) {
- free(result);
- return ErrorAbort(state, "%s: some changes failed", name);
- }
- return StringValue(result);
-}
-
struct perm_parsed_args {
bool has_uid;
uid_t uid;
@@ -1398,11 +1316,6 @@ void RegisterInstallFunctions() {
RegisterFunction("package_extract_file", PackageExtractFileFn);
RegisterFunction("symlink", SymlinkFn);
- // Maybe, at some future point, we can delete these functions? They have been
- // replaced by perm_set and perm_set_recursive.
- RegisterFunction("set_perm", SetPermFn);
- RegisterFunction("set_perm_recursive", SetPermFn);
-
// Usage:
// set_metadata("filename", "key1", "value1", "key2", "value2", ...)
// Example: