1
0
Fork 0

check if stat succeeded before using it(Kippesoep)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2220
This commit is contained in:
Peter Veenstra 2005-06-16 18:38:08 +00:00
parent 6e2a8288d0
commit d8ae7b8f88

View file

@ -185,10 +185,8 @@ int CDROM_GetMountType(char* path, int forceCD)
// Detect ISO
struct stat file_stat;
stat(path, &file_stat);
if (S_ISREG(file_stat.st_mode)) return 1;
return 2;
if ((stat(path, &file_stat) == 0) && S_ISREG(file_stat.st_mode)) return 1;
return 2;
};
// ******************************************************