--- a/libidu/walker.c +++ b/libidu/walker.c @@ -618,14 +618,15 @@ dir_link = 0; #endif links = links_0 = vectorize_string (cwd, SLASH_STRING); - while (*links) - { - struct stat st; - char const* link_name = *links++; - dir_link = get_link_from_string (link_name, dir_link); - if (!dir_link->fl_flags) - dir_link->fl_flags = classify_link (dir_link, &st); - } + if (*links && **links) /* Not in / */ + while (*links) + { + struct stat st; + char const* link_name = *links++; + dir_link = get_link_from_string (link_name, dir_link); + if (!dir_link->fl_flags) + dir_link->fl_flags = classify_link (dir_link, &st); + } chdir_to_link (dir_link); free (links_0); free (cwd); @@ -1111,16 +1112,16 @@ /* Expand to the definition of a function that hashes a dev+inode pair, with application of XFORM. */ #define DEV_INO_HASH_DEFUN(FN_NAME, XFORM) \ -static size_t _GL_ATTRIBUTE_PURE \ +static unsigned long _GL_ATTRIBUTE_PURE \ FN_NAME (void const *x) \ { \ struct dev_ino const *p = x; \ ino_t ino = p->di_ino; \ \ - /* When INO is wider than size_t, XOR the words of INO into H. \ + /* When INO is wider than unsigned long, XOR the words of INO into H. \ This avoids loss of info, without applying % to the wider type, \ which could be quite slow on some systems. */ \ - size_t h = XFORM (ino); \ + unsigned long h = XFORM (ino); \ unsigned int n_words = sizeof ino / sizeof h + (sizeof ino % sizeof h != 0); \ for (unsigned int i = 1; i < n_words; i++) \ h ^= XFORM (ino >> CHAR_BIT * sizeof h * i); \ @@ -1133,17 +1134,26 @@ \ return h; \ } -static inline size_t xform_NOP (size_t k) { return k; } -static inline size_t xform_NOT (size_t k) { return ~k; } +static inline unsigned long xform_NOP (unsigned long k) { return k; } +static inline unsigned long xform_NOT (unsigned long k) { return ~k; } DEV_INO_HASH_DEFUN(dev_ino_hash_1, xform_NOP) DEV_INO_HASH_DEFUN(dev_ino_hash_2, xform_NOT) +/* Note, this is a compare, not a boolian test for equality. +It returns negative, positive, or 0, with 0 indicating equality. */ static int dev_ino_hash_compare (void const *xv, void const *yv) { struct dev_ino const *x = xv; struct dev_ino const *y = yv; - return x->di_ino == y->di_ino && x->di_dev == y->di_dev; + int result; + INTEGER_COMPARE ( x->di_ino, + y->di_ino, result); + if (result) + return result; + INTEGER_COMPARE (x->di_dev, + y->di_dev, result); + return result; } #endif