1
0
Fork 0

Test using Macro instead of &. Check for failure to open an image. Thanks Malvineous

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3965
This commit is contained in:
Peter Veenstra 2016-02-11 15:47:15 +00:00
parent 3000bd2feb
commit c96a19e3d9

View file

@ -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);