diff options
author | Nick Kralevich <nnk@google.com> | 2013-09-11 11:37:10 -0700 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2013-09-11 11:37:10 -0700 |
commit | 08ef9a957027183dcf55e432441e8fb0d5299aba (patch) | |
tree | 8de1908105a0bd46cd66c53235bbbfb746433f5e /minzip | |
parent | 53e8f3091849e80585044dfff4a7075c26936543 (diff) | |
download | bootable_recovery-08ef9a957027183dcf55e432441e8fb0d5299aba.zip bootable_recovery-08ef9a957027183dcf55e432441e8fb0d5299aba.tar.gz bootable_recovery-08ef9a957027183dcf55e432441e8fb0d5299aba.tar.bz2 |
updater: Delete dead code
set_perm and set_perm_recursive are no longer used. Delete.
Change-Id: I3bb40b934b6c093b24b88aa4ed6f3c7de2bb52f0
Diffstat (limited to 'minzip')
-rw-r--r-- | minzip/DirUtil.c | 58 | ||||
-rw-r--r-- | minzip/DirUtil.h | 8 |
2 files changed, 0 insertions, 66 deletions
diff --git a/minzip/DirUtil.c b/minzip/DirUtil.c index 8dd5da1..fe2c880 100644 --- a/minzip/DirUtil.c +++ b/minzip/DirUtil.c @@ -234,61 +234,3 @@ dirUnlinkHierarchy(const char *path) /* delete target directory */ return rmdir(path); } - -int -dirSetHierarchyPermissions(const char *path, - int uid, int gid, int dirMode, int fileMode) -{ - struct stat st; - if (lstat(path, &st)) { - return -1; - } - - /* ignore symlinks */ - if (S_ISLNK(st.st_mode)) { - return 0; - } - - /* directories and files get different permissions */ - if (chown(path, uid, gid) || - chmod(path, S_ISDIR(st.st_mode) ? dirMode : fileMode)) { - return -1; - } - - /* recurse over directory components */ - if (S_ISDIR(st.st_mode)) { - DIR *dir = opendir(path); - if (dir == NULL) { - return -1; - } - - errno = 0; - const struct dirent *de; - while (errno == 0 && (de = readdir(dir)) != NULL) { - if (!strcmp(de->d_name, "..") || !strcmp(de->d_name, ".")) { - continue; - } - - char dn[PATH_MAX]; - snprintf(dn, sizeof(dn), "%s/%s", path, de->d_name); - if (!dirSetHierarchyPermissions(dn, uid, gid, dirMode, fileMode)) { - errno = 0; - } else if (errno == 0) { - errno = -1; - } - } - - if (errno != 0) { - int save = errno; - closedir(dir); - errno = save; - return -1; - } - - if (closedir(dir)) { - return -1; - } - } - - return 0; -} diff --git a/minzip/DirUtil.h b/minzip/DirUtil.h index a5cfa76..85a0012 100644 --- a/minzip/DirUtil.h +++ b/minzip/DirUtil.h @@ -48,14 +48,6 @@ int dirCreateHierarchy(const char *path, int mode, */ int dirUnlinkHierarchy(const char *path); -/* chown -R <uid>:<gid> <path> - * chmod -R <mode> <path> - * - * Sets directories to <dirMode> and files to <fileMode>. Skips symlinks. - */ -int dirSetHierarchyPermissions(const char *path, - int uid, int gid, int dirMode, int fileMode); - #ifdef __cplusplus } #endif |