diff --git a/BasiliskII/src/AmigaOS/extfs_amiga.cpp b/BasiliskII/src/AmigaOS/extfs_amiga.cpp index bbb4a6c5..5c066c79 100644 --- a/BasiliskII/src/AmigaOS/extfs_amiga.cpp +++ b/BasiliskII/src/AmigaOS/extfs_amiga.cpp @@ -84,7 +84,7 @@ struct finf_struct { uint32 type; uint32 creator; uint16 flags; - uint16 pad0; + uint8 pad0[22]; // total size: 32 bytes to match the size of FInfo+FXInfo }; static void make_helper_path(const char *src, char *dest, const char *add, bool only_dir = false) @@ -221,7 +221,7 @@ void get_finder_type(const char *path, uint32 &type, uint32 &creator) // Read file finf_struct finf; - if (read(fd, &finf, sizeof(finf_struct)) == sizeof(finf_struct)) { + if (read(fd, &finf, sizeof(finf_struct)) >= 8) { // Type/creator are in Finder info file, return them type = ntohl(finf.type); @@ -254,7 +254,9 @@ void set_finder_type(const char *path, uint32 type, uint32 creator) return; // Read file - finf_struct finf = {0, 0, DEFAULT_FINDER_FLAGS, 0}; + finf_struct finf; + finf.flags = DEFAULT_FINDER_FLAGS; + memset(&finf, 0, sizeof(finf_struct)); read(fd, &finf, sizeof(finf_struct)); // Set Finder flags @@ -283,7 +285,7 @@ void get_finder_flags(const char *path, uint16 &flags) // Read Finder flags finf_struct finf; - if (read(fd, &finf, sizeof(finf_struct)) == sizeof(finf_struct)) + if (read(fd, &finf, sizeof(finf_struct)) >= 10) flags = ntohs(finf.flags); // Close file @@ -298,7 +300,9 @@ void set_finder_flags(const char *path, uint16 flags) return; // Read file - finf_struct finf = {0, 0, DEFAULT_FINDER_FLAGS, 0}; + finf_struct finf; + memset(&finf, 0, sizeof(finf_struct)); + finf.flags = DEFAULT_FINDER_FLAGS; read(fd, &finf, sizeof(finf_struct)); // Set Finder flags diff --git a/BasiliskII/src/Unix/extfs_unix.cpp b/BasiliskII/src/Unix/extfs_unix.cpp index ebdee24a..5f7ce809 100644 --- a/BasiliskII/src/Unix/extfs_unix.cpp +++ b/BasiliskII/src/Unix/extfs_unix.cpp @@ -85,7 +85,7 @@ struct finf_struct { uint32 type; uint32 creator; uint16 flags; - uint16 pad0; + uint8 pad0[22]; // total size: 32 bytes to match the size of FInfo+FXInfo }; static void make_helper_path(const char *src, char *dest, const char *add, bool only_dir = false) @@ -226,7 +226,7 @@ void get_finder_type(const char *path, uint32 &type, uint32 &creator) // Read file finf_struct finf; - if (read(fd, &finf, sizeof(finf_struct)) == sizeof(finf_struct)) { + if (read(fd, &finf, sizeof(finf_struct)) >= 8) { // Type/creator are in Finder info file, return them type = ntohl(finf.type); @@ -259,7 +259,9 @@ void set_finder_type(const char *path, uint32 type, uint32 creator) return; // Read file - finf_struct finf = {0, 0, DEFAULT_FINDER_FLAGS, 0}; + finf_struct finf; + finf.flags = DEFAULT_FINDER_FLAGS; + memset(&finf, 0, sizeof(finf_struct)); read(fd, &finf, sizeof(finf_struct)); // Set Finder flags @@ -288,7 +290,7 @@ void get_finder_flags(const char *path, uint16 &flags) // Read Finder flags finf_struct finf; - if (read(fd, &finf, sizeof(finf_struct)) == sizeof(finf_struct)) + if (read(fd, &finf, sizeof(finf_struct)) >= 10) flags = ntohs(finf.flags); // Close file @@ -303,7 +305,9 @@ void set_finder_flags(const char *path, uint16 flags) return; // Read file - finf_struct finf = {0, 0, DEFAULT_FINDER_FLAGS, 0}; + finf_struct finf; + memset(&finf, 0, sizeof(finf_struct)); + finf.flags = DEFAULT_FINDER_FLAGS; read(fd, &finf, sizeof(finf_struct)); // Set Finder flags diff --git a/BasiliskII/src/Unix/main_unix.cpp b/BasiliskII/src/Unix/main_unix.cpp index 5c6f1b8d..c8f1bc59 100644 --- a/BasiliskII/src/Unix/main_unix.cpp +++ b/BasiliskII/src/Unix/main_unix.cpp @@ -268,7 +268,7 @@ int main(int argc, char **argv) req.it_value.tv_nsec = 16625000; req.it_interval.tv_sec = 0; req.it_interval.tv_nsec = 16625000; - if (timer_settime(timer, TIMER_RELTIME, &req, NULL) < 0) { + if (timer_settime(timer, 0, &req, NULL) < 0) { printf("FATAL: cannot start timer\n"); QuitEmulator(); }