|
@@ -1490,10 +1490,28 @@ int sys_get_prod(GlobalDeviceInfo *info)
|
|
|
|
|
|
|
|
int sys_chmod(void)
|
|
int sys_chmod(void)
|
|
|
{
|
|
{
|
|
|
- char cmd[200],tmp[100];
|
|
|
|
|
- sys_get_path(tmp, "*");
|
|
|
|
|
- sprintf(cmd, "chmod 777 %s", tmp);
|
|
|
|
|
- return system(cmd);
|
|
|
|
|
|
|
+ DIR *dir;
|
|
|
|
|
+ char path[200];
|
|
|
|
|
+ struct stat st;
|
|
|
|
|
+ struct dirent *entry;
|
|
|
|
|
+
|
|
|
|
|
+ sys_get_path(path, NULL);
|
|
|
|
|
+ dir = opendir(path);
|
|
|
|
|
+ if(!dir) {
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ chdir(path);
|
|
|
|
|
+ while ((entry=readdir(dir))) {
|
|
|
|
|
+ lstat(entry->d_name, &st);
|
|
|
|
|
+ if(S_ISDIR(st.st_mode)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ chmod(entry->d_name, S_IRWXG);
|
|
|
|
|
+ }
|
|
|
|
|
+ closedir(dir);
|
|
|
|
|
+
|
|
|
|
|
+ return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|