1187 |
|
return fnfErr; |
1188 |
|
} |
1189 |
|
if (de->d_name[0] == '.') |
1190 |
< |
goto read_next_de; // Suppress name beginning with '.' (MacOS could interpret these as driver names) |
1190 |
> |
goto read_next_de; // Suppress names beginning with '.' (MacOS could interpret these as driver names) |
1191 |
|
//!! suppress directories |
1192 |
|
} |
1193 |
|
add_path_comp(de->d_name); |
1316 |
|
return fnfErr; |
1317 |
|
} |
1318 |
|
if (de->d_name[0] == '.') |
1319 |
< |
goto read_next_de; // Suppress name beginning with '.' (MacOS could interpret these as driver names) |
1319 |
> |
goto read_next_de; // Suppress names beginning with '.' (MacOS could interpret these as driver names) |
1320 |
|
} |
1321 |
|
add_path_comp(de->d_name); |
1322 |
|
|
1352 |
|
fs_item->mtime = mtime; |
1353 |
|
cached = false; |
1354 |
|
} |
1355 |
< |
WriteMacInt32(pb + ioFlMdDat, mtime); |
1355 |
> |
WriteMacInt32(pb + ioFlMdDat, mtime + TIME_OFFSET); |
1356 |
|
WriteMacInt32(pb + ioFlBkDat, 0); |
1357 |
|
if (S_ISDIR(st.st_mode)) { |
1358 |
|
Mac_memset(pb + ioDrUsrWds, 0, SIZEOF_DInfo); |
1374 |
|
de = readdir(d); |
1375 |
|
if (de == NULL) |
1376 |
|
break; |
1377 |
+ |
if (de->d_name[0] == '.') |
1378 |
+ |
continue; // Suppress names beginning with '.' |
1379 |
|
count++; |
1380 |
|
} |
1381 |
|
closedir(d); |
1776 |
|
|
1777 |
|
// Read |
1778 |
|
size_t actual = extfs_read(fd, Mac2HostAddr(ReadMacInt32(pb + ioBuffer)), ReadMacInt32(pb + ioReqCount)); |
1779 |
+ |
int16 read_err = errno2oserr(); |
1780 |
|
D(bug(" actual %d\n", actual)); |
1781 |
|
WriteMacInt32(pb + ioActCount, actual); |
1782 |
|
uint32 pos = lseek(fd, 0, SEEK_CUR); |
1783 |
|
WriteMacInt32(fcb + fcbCrPs, pos); |
1784 |
|
WriteMacInt32(pb + ioPosOffset, pos); |
1785 |
|
if (actual != ReadMacInt32(pb + ioReqCount)) |
1786 |
< |
if (errno) |
1784 |
< |
return errno2oserr(); |
1785 |
< |
else |
1786 |
< |
return eofErr; |
1786 |
> |
return read_err ? read_err : eofErr; |
1787 |
|
else |
1788 |
|
return noErr; |
1789 |
|
} |
1825 |
|
|
1826 |
|
// Write |
1827 |
|
size_t actual = extfs_write(fd, Mac2HostAddr(ReadMacInt32(pb + ioBuffer)), ReadMacInt32(pb + ioReqCount)); |
1828 |
+ |
int16 write_err = errno2oserr(); |
1829 |
|
D(bug(" actual %d\n", actual)); |
1830 |
|
WriteMacInt32(pb + ioActCount, actual); |
1831 |
|
uint32 pos = lseek(fd, 0, SEEK_CUR); |
1832 |
|
WriteMacInt32(fcb + fcbCrPs, pos); |
1833 |
|
WriteMacInt32(pb + ioPosOffset, pos); |
1834 |
|
if (actual != ReadMacInt32(pb + ioReqCount)) |
1835 |
< |
return errno2oserr(); |
1835 |
> |
return write_err; |
1836 |
|
else |
1837 |
|
return noErr; |
1838 |
|
} |
1898 |
|
return result; |
1899 |
|
|
1900 |
|
// Delete file |
1901 |
< |
if (remove(full_path) < 0) { |
1902 |
< |
int16 err = errno2oserr(); |
1903 |
< |
if (errno == EISDIR) { // Workaround for BeOS bug |
1903 |
< |
if (rmdir(full_path) < 0) |
1904 |
< |
return errno2oserr(); |
1905 |
< |
else |
1906 |
< |
return noErr; |
1907 |
< |
} else |
1908 |
< |
return err; |
1909 |
< |
} else |
1901 |
> |
if (!extfs_remove(full_path)) |
1902 |
> |
return errno2oserr(); |
1903 |
> |
else |
1904 |
|
return noErr; |
1905 |
|
} |
1906 |
|
|
1933 |
|
|
1934 |
|
// Rename item |
1935 |
|
D(bug(" renaming %s -> %s\n", old_path, full_path)); |
1936 |
< |
if (rename(old_path, full_path) < 0) |
1936 |
> |
if (!extfs_rename(old_path, full_path)) |
1937 |
|
return errno2oserr(); |
1938 |
|
else { |
1939 |
|
// The ID of the old file/dir has to stay the same, so we swap the IDs of the FSItems |
1960 |
|
strcpy(old_path, full_path); |
1961 |
|
|
1962 |
|
// Find path for new directory |
1963 |
< |
Mac2Host_memcpy(fs_data + fsPB, pb, SIZEOF_IOParam); |
1963 |
> |
Mac2Mac_memcpy(fs_data + fsPB, pb, SIZEOF_IOParam); |
1964 |
|
WriteMacInt32(fs_data + fsPB + ioNamePtr, ReadMacInt32(pb + ioNewName)); |
1965 |
|
FSItem *new_dir_item; |
1966 |
|
result = get_item_and_path(fs_data + fsPB, ReadMacInt32(pb + ioNewDirID), new_dir_item); |
1976 |
|
|
1977 |
|
// Move item |
1978 |
|
D(bug(" moving %s -> %s\n", old_path, full_path)); |
1979 |
< |
if (rename(old_path, full_path) < 0) |
1979 |
> |
if (!extfs_rename(old_path, full_path)) |
1980 |
|
return errno2oserr(); |
1981 |
|
else { |
1982 |
|
// The ID of the old file/dir has to stay the same, so we swap the IDs of the FSItems |
2047 |
|
return r.d[0]; |
2048 |
|
|
2049 |
|
// Return information |
2050 |
< |
WriteMacInt16(pb + ioWDProcID, ReadMacInt32(wdcb + wdProcID)); |
2050 |
> |
WriteMacInt32(pb + ioWDProcID, ReadMacInt32(wdcb + wdProcID)); |
2051 |
|
WriteMacInt16(pb + ioWDVRefNum, ReadMacInt16(ReadMacInt32(wdcb + wdVCBPtr) + vcbVRefNum)); |
2052 |
|
if (ReadMacInt32(pb + ioNamePtr)) |
2053 |
|
Mac2Mac_memcpy(ReadMacInt32(pb + ioNamePtr), ReadMacInt32(wdcb + wdVCBPtr) + vcbVN, 28); |