From d8ae7b8f88b072ae4f9d84cddb730016421f1c0a Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Thu, 16 Jun 2005 18:38:08 +0000 Subject: [PATCH] check if stat succeeded before using it(Kippesoep) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2220 --- src/dos/cdrom.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/dos/cdrom.cpp b/src/dos/cdrom.cpp index 3597e3a9..4cd208e7 100644 --- a/src/dos/cdrom.cpp +++ b/src/dos/cdrom.cpp @@ -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; }; // ******************************************************