qa: newlib: fix 102-files so that it works with disk based roots (runDisk.sh)

This commit is contained in:
Giacomo Tesio 2017-08-30 00:15:50 +02:00
parent 713eb8843f
commit e888e52502
1 changed files with 7 additions and 7 deletions

View File

@ -11,34 +11,34 @@ main(int argc, char **argv)
DIR *dirp;
struct dirent *dp;
dirp = opendir("/");
dirp = opendir("/usr/glenda");
if(dirp != NULL)
printf("opendir(/): done\n");
printf("opendir(/usr/glenda): done\n");
else
printf("opendir(/): failed\n");
printf("opendir(/usr/glenda): failed\n");
while (dirp) {
errno = 0;
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){
++i;
printf("FOUND! ");
}
}
if (strcmp(dp->d_name, "sys") == 0) {
if (strcmp(dp->d_name, "tmp") == 0) {
if(dp->d_type == DT_DIR){
++i;
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){
closedir(dirp);
return 0;
}
} else {
printf("readdir returned NULL\n");
printf("readdir returned NULL before finding both readme.acme and tmp/\n");
if (errno == 0) {
closedir(dirp);
return 1;