--- BasiliskII/src/extfs.cpp 1999/11/03 19:08:52 1.10 +++ BasiliskII/src/extfs.cpp 1999/11/08 18:05:55 1.13 @@ -1187,7 +1187,7 @@ read_next_de: return fnfErr; } if (de->d_name[0] == '.') - goto read_next_de; // Suppress name beginning with '.' (MacOS could interpret these as driver names) + goto read_next_de; // Suppress names beginning with '.' (MacOS could interpret these as driver names) //!! suppress directories } add_path_comp(de->d_name); @@ -1316,7 +1316,7 @@ read_next_de: return fnfErr; } if (de->d_name[0] == '.') - goto read_next_de; // Suppress name beginning with '.' (MacOS could interpret these as driver names) + goto read_next_de; // Suppress names beginning with '.' (MacOS could interpret these as driver names) } add_path_comp(de->d_name); @@ -1352,7 +1352,7 @@ read_next_de: fs_item->mtime = mtime; cached = false; } - WriteMacInt32(pb + ioFlMdDat, mtime); + WriteMacInt32(pb + ioFlMdDat, mtime + TIME_OFFSET); WriteMacInt32(pb + ioFlBkDat, 0); if (S_ISDIR(st.st_mode)) { Mac_memset(pb + ioDrUsrWds, 0, SIZEOF_DInfo); @@ -1374,6 +1374,8 @@ read_next_de: de = readdir(d); if (de == NULL) break; + if (de->d_name[0] == '.') + continue; // Suppress names beginning with '.' count++; } closedir(d); @@ -1774,16 +1776,14 @@ static int16 fs_read(uint32 pb) // Read size_t actual = extfs_read(fd, Mac2HostAddr(ReadMacInt32(pb + ioBuffer)), ReadMacInt32(pb + ioReqCount)); + int16 read_err = errno2oserr(); D(bug(" actual %d\n", actual)); WriteMacInt32(pb + ioActCount, actual); uint32 pos = lseek(fd, 0, SEEK_CUR); WriteMacInt32(fcb + fcbCrPs, pos); WriteMacInt32(pb + ioPosOffset, pos); if (actual != ReadMacInt32(pb + ioReqCount)) - if (errno) - return errno2oserr(); - else - return eofErr; + return read_err ? read_err : eofErr; else return noErr; } @@ -1825,13 +1825,14 @@ static int16 fs_write(uint32 pb) // Write size_t actual = extfs_write(fd, Mac2HostAddr(ReadMacInt32(pb + ioBuffer)), ReadMacInt32(pb + ioReqCount)); + int16 write_err = errno2oserr(); D(bug(" actual %d\n", actual)); WriteMacInt32(pb + ioActCount, actual); uint32 pos = lseek(fd, 0, SEEK_CUR); WriteMacInt32(fcb + fcbCrPs, pos); WriteMacInt32(pb + ioPosOffset, pos); if (actual != ReadMacInt32(pb + ioReqCount)) - return errno2oserr(); + return write_err; else return noErr; } @@ -1897,16 +1898,9 @@ static int16 fs_delete(uint32 pb, uint32 return result; // Delete file - if (remove(full_path) < 0) { - int16 err = errno2oserr(); - if (errno == EISDIR) { // Workaround for BeOS bug - if (rmdir(full_path) < 0) - return errno2oserr(); - else - return noErr; - } else - return err; - } else + if (!extfs_remove(full_path)) + return errno2oserr(); + else return noErr; } @@ -1939,7 +1933,7 @@ static int16 fs_rename(uint32 pb, uint32 // Rename item D(bug(" renaming %s -> %s\n", old_path, full_path)); - if (rename(old_path, full_path) < 0) + if (!extfs_rename(old_path, full_path)) return errno2oserr(); else { // The ID of the old file/dir has to stay the same, so we swap the IDs of the FSItems @@ -1982,7 +1976,7 @@ static int16 fs_cat_move(uint32 pb) // Move item D(bug(" moving %s -> %s\n", old_path, full_path)); - if (rename(old_path, full_path) < 0) + if (!extfs_rename(old_path, full_path)) return errno2oserr(); else { // The ID of the old file/dir has to stay the same, so we swap the IDs of the FSItems @@ -2053,7 +2047,7 @@ static int16 fs_get_wd_info(uint32 pb, u return r.d[0]; // Return information - WriteMacInt16(pb + ioWDProcID, ReadMacInt32(wdcb + wdProcID)); + WriteMacInt32(pb + ioWDProcID, ReadMacInt32(wdcb + wdProcID)); WriteMacInt16(pb + ioWDVRefNum, ReadMacInt16(ReadMacInt32(wdcb + wdVCBPtr) + vcbVRefNum)); if (ReadMacInt32(pb + ioNamePtr)) Mac2Mac_memcpy(ReadMacInt32(pb + ioNamePtr), ReadMacInt32(wdcb + wdVCBPtr) + vcbVN, 28);