| 30 | } |
| 31 | |
| 32 | void DexFileHook::setFileReadonly(const char* filePath) { |
| 33 | struct stat fileStat; |
| 34 | |
| 35 | |
| 36 | if (stat(filePath, &fileStat) != 0) { |
| 37 | ALOGD("DexFileHook::setFileReadonly: %s 不存在",filePath); |
| 38 | return; |
| 39 | } |
| 40 | |
| 41 | |
| 42 | |
| 43 | if (chmod(filePath, S_IRUSR) != 0) { |
| 44 | ALOGD("DexFileHook::setFileReadonly: 设置文件 %s 为只读时出错",filePath); |
| 45 | } else { |
| 46 | ALOGD("DexFileHook::setFileReadonly: 设置文件 %s 为只读成功",filePath); |
| 47 | } |
| 48 | } |