VOGONS


First post, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

When I did a CVS update just now, I got the joystick patch. There seems to be a minor bug in joystick.cpp, though.

The code uses strcasecmp, but doesn't include support.h, which #defines this for MSVC. Since support.h includes dosbox.h, the fix is simply to replace #include "dosbox.h" with #include "support.h"

There's also a minor bug in cdrom.cpp, function CDROM_GetMountType:

// Detect ISO
struct stat file_stat;
stat(path, &file_stat);
if (S_ISREG(file_stat.st_mode)) return 1;

return 2;

This becomes apparent in debug mode when mounting a directory as CD-ROM. file_stat is not initialised and stat fails. The error value is not checked. In a debug compile, file_stat is filled with 0xCC and S_ISREG evaluates to true. This in turn causes the directory to be misreported as an ISO file.

Fix:

// Detect ISO
struct stat file_stat = {0};
if (stat(path, &file_stat) == 0 && S_ISREG(file_stat.st_mode)) return 1;

return 2;