Avoided a confusing error message from iso_image_update_sizes(),
prepared macro for non-confusing error message, and introduced flag bit0 to iso_stream_get_input_stream()
This commit is contained in:
parent
e886722d65
commit
b1c7ed6e29
@ -392,6 +392,14 @@ static
|
||||
int dir_update_size(IsoImage *image, IsoDir *dir)
|
||||
{
|
||||
IsoNode *pos;
|
||||
|
||||
#ifdef Libisofs_update_sizes_abortablE
|
||||
char *path= NULL;
|
||||
IsoStream *base_stream;
|
||||
int cancel_ret, ret;
|
||||
uint32_t lba;
|
||||
#endif
|
||||
|
||||
pos = dir->children;
|
||||
while (pos) {
|
||||
int ret = 1;
|
||||
@ -400,13 +408,51 @@ int dir_update_size(IsoImage *image, IsoDir *dir)
|
||||
} else if (pos->type == LIBISO_DIR) {
|
||||
/* recurse */
|
||||
ret = dir_update_size(image, ISO_DIR(pos));
|
||||
|
||||
#ifdef Libisofs_update_sizes_abortablE
|
||||
if (ret == ISO_CANCELED)
|
||||
return ret; /* Message already issued by dir_update_size */
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef Libisofs_update_sizes_abortablE
|
||||
|
||||
/* This would report error and abort according to severity threshold.
|
||||
But it is desirable to let the update_size crawler continue
|
||||
its work after e.g. a file has vanished from hard disk.
|
||||
So normally this macro case should be disabled.
|
||||
*/
|
||||
|
||||
if (ret < 0) {
|
||||
ret = iso_msg_submit(image->id, ret, 0, NULL);
|
||||
if (ret < 0) {
|
||||
return ret; /* cancel due error threshold */
|
||||
cancel_ret = iso_msg_submit(image->id, ret, 0, NULL);
|
||||
path = iso_tree_get_node_path(pos);
|
||||
if (path != NULL) {
|
||||
iso_msg_submit(image->id, ret, 0,
|
||||
"ISO path : %s", path);
|
||||
free(path);
|
||||
}
|
||||
/* Report source path with streams which do not come from
|
||||
the loaded ISO filesystem */
|
||||
if (pos->type == LIBISO_FILE &&
|
||||
iso_node_get_old_image_lba(pos, &lba, 0) == 0) {
|
||||
base_stream = iso_stream_get_input_stream(
|
||||
ISO_FILE(pos)->stream, 1);
|
||||
if (base_stream == NULL)
|
||||
base_stream = ISO_FILE(pos)->stream;
|
||||
path = iso_stream_get_source_path(base_stream, 0);
|
||||
if (path != NULL) {
|
||||
iso_msg_submit(image->id, ret, 0,
|
||||
"Local path: %s", path);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
if (cancel_ret < 0)
|
||||
return cancel_ret; /* cancel due error threshold */
|
||||
}
|
||||
|
||||
#endif /* Libisofs_update_sizes_abortablE */
|
||||
|
||||
pos = pos->next;
|
||||
}
|
||||
return ISO_SUCCESS;
|
||||
|
@ -6421,7 +6421,10 @@ int iso_file_remove_filter(IsoFile *file, int flag);
|
||||
* @param stream
|
||||
* The eventual filter stream to be inquired.
|
||||
* @param flag
|
||||
* Bitfield for control purposes. Submit 0 for now.
|
||||
* Bitfield for control purposes.
|
||||
* bit0= Follow the chain of input streams and return the one at the
|
||||
* end of the chain.
|
||||
* @since 1.3.2
|
||||
* @return
|
||||
* The input stream, if one exists. Elsewise NULL.
|
||||
* No extra reference to the stream is taken by this call.
|
||||
|
@ -890,17 +890,27 @@ void iso_stream_get_file_name(IsoStream *stream, char *name)
|
||||
}
|
||||
}
|
||||
|
||||
/* @param flag bit0= Obtain most fundamental stream */
|
||||
IsoStream *iso_stream_get_input_stream(IsoStream *stream, int flag)
|
||||
{
|
||||
IsoStreamIface* class;
|
||||
IsoStream *result = NULL, *next;
|
||||
|
||||
if (stream == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
while (1) {
|
||||
class = stream->class;
|
||||
if (class->version < 2)
|
||||
return NULL;
|
||||
return class->get_input_stream(stream, 0);
|
||||
return result;
|
||||
next = class->get_input_stream(stream, 0);
|
||||
if (next == NULL)
|
||||
return result;
|
||||
result = next;
|
||||
if (!(flag & 1))
|
||||
return result;
|
||||
stream = result;
|
||||
}
|
||||
}
|
||||
|
||||
char *iso_stream_get_source_path(IsoStream *stream, int flag)
|
||||
|
@ -803,6 +803,8 @@ int iso_add_dir_src_rec(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
||||
ret = iso_file_source_lstat(file, &info);
|
||||
}
|
||||
if (ret < 0) {
|
||||
ret = iso_msg_submit(image->id, ISO_FILE_CANT_ADD, ret,
|
||||
"Error when adding file %s", path);
|
||||
goto dir_rec_continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user