From: Jay Freeman (saurik) Date: Sat, 14 Jun 2008 20:42:54 +0000 (+0000) Subject: Maintain permissions during codehashing. X-Git-Tag: v1.0.363~6 X-Git-Url: https://git.saurik.com/ldid.git/commitdiff_plain/31ad673ba62d384fcdfa4d6f64d2ca328770da1d Maintain permissions during codehashing. --- diff --git a/ldid.cpp b/ldid.cpp index d38e6b3..dc1902e 100644 --- a/ldid.cpp +++ b/ldid.cpp @@ -45,6 +45,8 @@ #include #include +#include +#include struct fat_header { uint32_t magic; @@ -337,6 +339,7 @@ int main(int argc, const char *argv[]) { const char *path(file->c_str()); const char *base = strrchr(path, '/'); char *temp(NULL), *dir; + mode_t mode = 0; if (base != NULL) dir = strndup(path, base++ - path + 1); @@ -506,6 +509,10 @@ int main(int argc, const char *argv[]) { } if (temp) { + struct stat info; + _syscall(stat(path, &info)); + _syscall(chown(temp, info.st_uid, info.st_gid)); + _syscall(chmod(temp, info.st_mode)); _syscall(unlink(path)); _syscall(rename(temp, path)); free(temp);