[haiku-commits] r40820 - haiku/trunk/src/apps/installer

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 5 Mar 2011 18:37:25 +0100 (CET)

Author: stippi
Date: 2011-03-05 18:37:24 +0100 (Sat, 05 Mar 2011)
New Revision: 40820
Changeset: http://dev.haiku-os.org/changeset/40820

Modified:
   haiku/trunk/src/apps/installer/WorkerThread.cpp
Log:
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.


Modified: haiku/trunk/src/apps/installer/WorkerThread.cpp
===================================================================
--- haiku/trunk/src/apps/installer/WorkerThread.cpp     2011-03-05 17:17:19 UTC 
(rev 40819)
+++ haiku/trunk/src/apps/installer/WorkerThread.cpp     2011-03-05 17:37:24 UTC 
(rev 40820)
@@ -483,7 +483,7 @@
        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 @@
                        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;
                }
 


Other related posts:

  • » [haiku-commits] r40820 - haiku/trunk/src/apps/installer - superstippi