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:
parent
6e2a8288d0
commit
d8ae7b8f88
1 changed files with 2 additions and 4 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
// ******************************************************
|
||||
|
|
Loading…
Add table
Reference in a new issue