diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 82fc324c..4086b167 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -298,7 +298,7 @@ public: return; } /* Not a switch so a normal directory/file */ - if (!(test.st_mode & S_IFDIR)) { + if (!S_ISDIR(test.st_mode)) { #ifdef OS2 HFILE cdrom_fd = 0; ULONG ulAction = 0; @@ -1216,7 +1216,7 @@ public: } } } - if ((test.st_mode & S_IFDIR)) { + if (S_ISDIR(test.st_mode)) { WriteOut(MSG_Get("PROGRAM_IMGMOUNT_MOUNT")); return; } @@ -1232,7 +1232,7 @@ public: if(fstype=="fat") { if (imgsizedetect) { FILE * diskfile = fopen(temp_line.c_str(), "rb+"); - if(!diskfile) { + if (!diskfile) { WriteOut(MSG_Get("PROGRAM_IMGMOUNT_INVALID_IMAGE")); return; } @@ -1377,6 +1377,10 @@ public: } else { FILE *newDisk = fopen(temp_line.c_str(), "rb+"); + if (!newDisk) { + WriteOut(MSG_Get("PROGRAM_IMGMOUNT_INVALID_IMAGE")); + return; + } fseek(newDisk,0L, SEEK_END); imagesize = (ftell(newDisk) / 1024);