I used "fopen" in a C program to open a file in readonly (r) mode. But in my case, I noticed that the fopen call does not return. It does not return NULL or a valid pointer - execution is blocked when fopen is called. The file patch is absolutely right (I already confirmed it), and there are no permissions. Someone can tell what could be the cause of this kind if behavior. Any help is really noticeable. Is there anything related to gcc or glibc?
EDIT
Here is a sample code
printf("%s %d\n",__FUNCTION__,__LINE__); if ((fp = fopen(argv[1], "r")) == NULL) { printf("%s %d\n",__FUNCTION__,__LINE__); return; } printf("%s %d\n",__FUNCTION__,__LINE__);
When I run this code, I get only the first print (before calling fopen), and after that the program just stops. Thus, fopen does not exit. The file is a simple configuration file with the extension ".conf", and this file can be opened in all other ways, such as vi, cat, etc. There should not be any problems with NFS. The file system is ext3.
Thanks in advance, Souvik
Souvik
source share