From c6f1101e9d1cbfe874cae1542a138958dd65b984 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 6 May 2009 16:18:45 +0200 Subject: [PATCH] Fixed a severe inode number mash-up from revision 554 and a minor bug introduced with revision 547 (for ticket 147). --- libisofs/ecma119_tree.c | 3 ++- libisofs/stream.c | 28 +++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libisofs/ecma119_tree.c b/libisofs/ecma119_tree.c index 7d6fc44..c8be8e4 100644 --- a/libisofs/ecma119_tree.c +++ b/libisofs/ecma119_tree.c @@ -904,6 +904,7 @@ int ecma119_node_cmp(const void *v1, const void *v2) if (n1 == n2) return 0; + /* Imported or explicite ISO image node id has absolute priority */ ret1 = (iso_node_get_id(n1->node, &fs_id1, &dev_id1, &ino_id1, 1) > 0); ret2 = (iso_node_get_id(n2->node, &fs_id2, &dev_id2, &ino_id2, 1) > 0); @@ -922,7 +923,7 @@ int ecma119_node_cmp(const void *v1, const void *v2) return 1; if (n1->type == ECMA119_FILE) { - ret1 = iso_file_src_cmp(n2->info.file, n2->info.file); + ret1 = iso_file_src_cmp(n1->info.file, n2->info.file); return ret1; #ifdef Libisofs_hardlink_matcheR diff --git a/libisofs/stream.c b/libisofs/stream.c index 79935f3..09af2de 100644 --- a/libisofs/stream.c +++ b/libisofs/stream.c @@ -675,7 +675,7 @@ IsoStream *iso_stream_get_input_stream(IsoStream *stream, int flag) IsoStreamIface* class; if (stream == NULL) { - return ISO_NULL_POINTER; + return NULL; } class = stream->class; if (class->version < 2) @@ -737,6 +737,10 @@ int iso_stream_cmp_ino(IsoStream *s1, IsoStream *s2, int flag) ino_t ino_id1, ino_id2; off_t size1, size2; + /* <<< */ + static int report_counter = 0; + static int debug = 1; + if (s1 == s2) { return 0; } @@ -760,8 +764,30 @@ int iso_stream_cmp_ino(IsoStream *s1, IsoStream *s2, int flag) size1 = iso_stream_get_size(s1); size2 = iso_stream_get_size(s2); if (size1 < size2) { + + if (debug) { + if (report_counter < 5) + fprintf(stderr, + "\n\nlibisofs_DEBUG : Program error: same ino but differing size\n\n\n"); + else if (report_counter == 5) + fprintf(stderr, + "\n\nlibisofs_DEBUG : Inode error: more of same ino but differing size\n\n\n"); + report_counter++; + } + return -1; } else if (size1 > size2) { + + if (debug) { + if (report_counter < 5) + fprintf(stderr, + "\n\nlibisofs_DEBUG : Inode error: same ino but differing size\n\n\n"); + else if (report_counter == 5) + fprintf(stderr, + "\n\nlibisofs_DEBUG : Program error: more of same ino but differing size\n\n\n"); + report_counter++; + } + return 1; }