From df4e063a13213f8c8a4f60723498944181f8e25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 5 Mar 2011 17:37:24 +0000 Subject: [PATCH] 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 --- src/apps/installer/WorkerThread.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/apps/installer/WorkerThread.cpp b/src/apps/installer/WorkerThread.cpp index 933119b9c2..2ed11c35e9 100644 --- a/src/apps/installer/WorkerThread.cpp +++ b/src/apps/installer/WorkerThread.cpp @@ -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; }