aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfs')
-rw-r--r--fs/hfs/catalog.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
index ff0316b925a5..db458ee3a546 100644
--- a/fs/hfs/catalog.c
+++ b/fs/hfs/catalog.c
@@ -162,14 +162,16 @@ err2:
162 */ 162 */
163int hfs_cat_keycmp(const btree_key *key1, const btree_key *key2) 163int hfs_cat_keycmp(const btree_key *key1, const btree_key *key2)
164{ 164{
165 int retval; 165 __be32 k1p, k2p;
166 166
167 retval = be32_to_cpu(key1->cat.ParID) - be32_to_cpu(key2->cat.ParID); 167 k1p = key1->cat.ParID;
168 if (!retval) 168 k2p = key2->cat.ParID;
169 retval = hfs_strcmp(key1->cat.CName.name, key1->cat.CName.len,
170 key2->cat.CName.name, key2->cat.CName.len);
171 169
172 return retval; 170 if (k1p != k2p)
171 return be32_to_cpu(k1p) < be32_to_cpu(k2p) ? -1 : 1;
172
173 return hfs_strcmp(key1->cat.CName.name, key1->cat.CName.len,
174 key2->cat.CName.name, key2->cat.CName.len);
173} 175}
174 176
175/* Try to get a catalog entry for given catalog id */ 177/* Try to get a catalog entry for given catalog id */