Of course I did not get this right on first try... the targetDevice
was taken from sourceDirectory, and fs_read_index_dir does not set errno when returning NULL (i.e. no more index entry), which resulted in the logic to think an error happened, but it only carried over from fs_create_index() when the index already existed. I think lsindex needs to be fixed as well, since it checks errno after fs_read_index_dir(). In case fs_read_index_dir() is supposed to set errno, it should reset it internally before it's possible to encounter any error. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40820 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -483,7 +483,7 @@ WorkerThread::_MirrorIndices(const BPath& sourceDirectory,
|
||||
dev_t sourceDevice = dev_for_path(sourceDirectory.Path());
|
||||
if (sourceDevice < 0)
|
||||
return (status_t)sourceDevice;
|
||||
dev_t targetDevice = dev_for_path(sourceDirectory.Path());
|
||||
dev_t targetDevice = dev_for_path(targetDirectory.Path());
|
||||
if (targetDevice < 0)
|
||||
return (status_t)targetDevice;
|
||||
DIR* indices = fs_open_index_dir(sourceDevice);
|
||||
@@ -497,19 +497,10 @@ WorkerThread::_MirrorIndices(const BPath& sourceDirectory,
|
||||
errno, strerror(errno));
|
||||
return errno;
|
||||
}
|
||||
while (true) {
|
||||
dirent* index = fs_read_index_dir(indices);
|
||||
if (index == NULL) {
|
||||
if (errno != B_ENTRY_NOT_FOUND && errno != B_OK) {
|
||||
printf("%s: fs_read_index_dir: (%d) %s\n",
|
||||
sourceDirectory.Path(), errno, strerror(errno));
|
||||
return errno;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!strcmp(index->d_name, "name")
|
||||
|| !strcmp(index->d_name, "size")
|
||||
|| !strcmp(index->d_name, "last_modified")) {
|
||||
while (dirent* index = fs_read_index_dir(indices)) {
|
||||
if (strcmp(index->d_name, "name") == 0
|
||||
|| strcmp(index->d_name, "size") == 0
|
||||
|| strcmp(index->d_name, "last_modified") == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user