Avoided to read content of non-regular files

This commit is contained in:
Thomas Schmitt 2008-02-26 21:28:51 +00:00
parent 103a02a6c0
commit 65cdcf4e99

View File

@ -171,7 +171,7 @@ int Compare_2_files(char *adr1, char *adr2, char *adrc, int flag)
differs= 1; differs= 1;
} }
} }
if(S_ISREG(s1.st_mode)) { if(S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)) {
fd1= open(adr1, O_RDONLY); fd1= open(adr1, O_RDONLY);
if(fd1==-1) { if(fd1==-1) {
printf("- %s : cannot open() : %s\n", adr1, strerror(errno)); printf("- %s : cannot open() : %s\n", adr1, strerror(errno));