This short program illustrates the problem: test00.c:
include
include
include
int main()
{
FILE *fd;
int open_files=0;
while (1){
fd = fopen("test00.c","r");
fclose(fd);
if (fd)
open_files++;
else
break;
}
printf("errno:%d\nopen:%d\n",errno,open_files);
}
It should never terminate but fails after about 125 iterations (close to MAX_FILES value set in pk/file.c), the behaviour is the same as when "fclose" is commented out.
This short program illustrates the problem: test00.c:
include
include
include
int main() { FILE *fd; int open_files=0; while (1){ fd = fopen("test00.c","r"); fclose(fd); if (fd) open_files++; else break; } printf("errno:%d\nopen:%d\n",errno,open_files); }
It should never terminate but fails after about 125 iterations (close to MAX_FILES value set in pk/file.c), the behaviour is the same as when "fclose" is commented out.