qa: newlib: fix 102-files so that it works with disk based roots (runDisk.sh)
This commit is contained in:
parent
713eb8843f
commit
e888e52502
|
@ -11,34 +11,34 @@ main(int argc, char **argv)
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
|
|
||||||
dirp = opendir("/");
|
dirp = opendir("/usr/glenda");
|
||||||
if(dirp != NULL)
|
if(dirp != NULL)
|
||||||
printf("opendir(/): done\n");
|
printf("opendir(/usr/glenda): done\n");
|
||||||
else
|
else
|
||||||
printf("opendir(/): failed\n");
|
printf("opendir(/usr/glenda): failed\n");
|
||||||
|
|
||||||
while (dirp) {
|
while (dirp) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if ((dp = readdir(dirp)) != NULL) {
|
if ((dp = readdir(dirp)) != NULL) {
|
||||||
if (strcmp(dp->d_name, "README.md") == 0) {
|
if (strcmp(dp->d_name, "readme.acme") == 0) {
|
||||||
if(dp->d_type == DT_REG){
|
if(dp->d_type == DT_REG){
|
||||||
++i;
|
++i;
|
||||||
printf("FOUND! ");
|
printf("FOUND! ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strcmp(dp->d_name, "sys") == 0) {
|
if (strcmp(dp->d_name, "tmp") == 0) {
|
||||||
if(dp->d_type == DT_DIR){
|
if(dp->d_type == DT_DIR){
|
||||||
++i;
|
++i;
|
||||||
printf("FOUND! ");
|
printf("FOUND! ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("%s: %s\n", dp->d_name, dp->d_type == DT_DIR ? "directory" : "regular");
|
printf("%s: %s\n", dp->d_name, dp->d_type == DT_DIR ? "directory" : "regular file");
|
||||||
if(i == 2){
|
if(i == 2){
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("readdir returned NULL\n");
|
printf("readdir returned NULL before finding both readme.acme and tmp/\n");
|
||||||
if (errno == 0) {
|
if (errno == 0) {
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue