Hello,
I'm checkng whether a file has been modified or not in order to refresh the content... However, i need a couple improvements : - How do I test the return value of stat to tell if it failed ? - The returned errno numbers may change between glibc versions, right ? in this case it is useless to do errno==... How do I fix that ?
Please help, thank you !
int is_refreshing_needed (char * path)
{
int refresh_content;
struct stat file;
stat(path, &file);
//File does not exist or Permission Denied or the file has not been modified
if( errno == 2 || errno == 13 || file.st_atime > file.st_mtime ) {
refresh_content=0;
}
else {
refresh_content=1;
}
return refresh_content;
}