안드로이드/포팅
skipping insecure file
code cat
2014. 4. 13. 18:36
[ 3.11328] init: skipping insecure file '/default.prop'
[ 3.133259] init: skipping insecure file '/init.rc'
라는 에러 메세지가 나오면서 부팅이 안되면, 이는 다음과 같이 젤리빈(이상버전 동일?)에서 다음과 같이 파일 스탯을 참조하여, owner외에 writable 못하게 막아놓았기 때문이다.
143 char *data; 144 int sz; 145 int fd; 146 struct stat sb; 147 148 data = 0; 149 fd = open(fn, O_RDONLY); 150 if(fd < 0) return 0; 151 152 // for security reasons, disallow world-writable 153 // or group-writable files 154 if (fstat(fd, &sb) < 0) { 155 ERROR("fstat failed for '%s'\n", fn); 156 goto oops; 157 } 158 if ((sb.st_mode & (S_IWGRP | S_IWOTH)) != 0) {
그럼 간단히, 644 혹은, 655 정도로 파일 퍼미션을 바꿔주면 된다.