The following seg faults eventually
If I replace the malloc line withCode:#include <sys/stat.h>
struct stat *fmt;
fmt=malloc(sizeof(struct stat *));
do{
if(0!=stat(file,fmt)){
printf("cannot watch the time stamp for the journal file\n");
exit(1);
}
if(wait<MAX_WAIT) wait++;
epoch=fmt->st_mtime;
} while(old_epoch>epoch);
free(fmt);
seg faults goes away.Code:fmt=malloc(100+sizeof(struct stat *));
What is the correct way to do this?
Thanks