Compare commits

...

22 Commits

Author SHA1 Message Date
745a878884 Version leap to 1.1.4 2011-08-08 09:35:46 +02:00
6ae8386c23 Bug fix: The function for restoring ACLs and xattr returned error on systems
other than Linux and FreeBSD, even if nothing was to be restored.
2011-08-08 08:25:18 +02:00
b90e613246 Reacted on warnings of cppcheck 2011-07-11 12:44:12 +02:00
bbc3caf86b Reacted on warnings of cppcheck 2011-07-11 12:43:12 +02:00
b086d53274 Reacted on warnings of cppcheck 2011-07-11 12:41:30 +02:00
17b36623a6 Version leap to 1.1.3 2011-07-08 14:42:09 +02:00
286648574d Version leap to 1.1.2 2011-07-08 10:28:12 +02:00
317bba395e Updated changelog 2011-07-08 10:25:24 +02:00
541b41b6a1 Clarified a comment about retrieving content of boot catalog. 2011-07-07 14:11:30 +02:00
91a8be5262 Silenced a warning of cppcheck about possible null pointer dereference. 2011-07-06 12:31:37 +02:00
91e99703b4 Reacted on warnings of -Wunused-but-set-variable 2011-07-04 18:54:11 +02:00
dd7dac3397 Reacted on warnings of -Wunused-but-set-variable 2011-07-04 16:07:35 +02:00
43d4833dd6 Reacted on warnings of -Wunused-but-set-variable 2011-07-04 16:06:16 +02:00
dd1629b5ca Reacted on warnings of -Wunused-but-set-variable 2011-07-04 16:04:05 +02:00
bc8138ce78 Reacted on warnings of -Wunused-but-set-variable 2011-07-04 16:00:29 +02:00
2d568c1dbb Reacted on warnings of -Wunused-but-set-variable 2011-07-04 15:56:26 +02:00
842b62d111 Reacted on warnings of -Wunused-but-set-variable 2011-07-04 15:50:52 +02:00
4f3357e3ec Reacted on warnings of -Wunused-but-set-variable 2011-07-04 15:39:38 +02:00
9ffe91c372 Reacted on warnings of -Wunused-but-set-variable 2011-07-04 15:37:55 +02:00
7e2add413a Reacted on warnings of -Wunused-but-set-variable 2011-07-04 15:35:43 +02:00
004aefd0b7 New API call iso_image_get_bootcat() 2011-07-03 21:02:19 +02:00
00955ba85c Version leap to 1.1.1 2011-06-18 19:22:11 +02:00
20 changed files with 219 additions and 64 deletions

View File

@ -1,3 +1,11 @@
libisofs-1.1.2.tar.gz Fri Jul 08 2011
===============================================================================
* Bug fix: The function for restoring ACLs and xattr returned error on systems
other than Linux and FreeBSD, even if nothing was to be restored.
libisofs-1.1.2.tar.gz Fri Jul 08 2011
===============================================================================
* New API call iso_image_get_bootcat()
libisofs-1.1.0.tar.gz Sat Jun 18 2011
===============================================================================

View File

@ -1,4 +1,4 @@
AC_INIT([libisofs], [1.1.0], [http://libburnia-project.org])
AC_INIT([libisofs], [1.1.4], [http://libburnia-project.org])
AC_PREREQ([2.50])
dnl AC_CONFIG_HEADER([config.h])
@ -41,7 +41,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
dnl
LIBISOFS_MAJOR_VERSION=1
LIBISOFS_MINOR_VERSION=1
LIBISOFS_MICRO_VERSION=0
LIBISOFS_MICRO_VERSION=4
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
AC_SUBST(LIBISOFS_MAJOR_VERSION)
@ -51,10 +51,10 @@ AC_SUBST(LIBISOFS_VERSION)
dnl Libtool versioning
LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
# 2011.06.18 development jump has not yet happened
# SONAME = 54 - 48 = 6 . Library name = libisofs.6.48.0
LT_CURRENT=54
LT_AGE=48
# 2011.08.08 development jump has not yet happened
# SONAME = 58 - 52 = 6 . Library name = libisofs.6.52.0
LT_CURRENT=58
LT_AGE=52
LT_REVISION=0
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`

View File

@ -89,8 +89,12 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
continue;
}
/* Extended Attribute */
if(!(flag & 4))
return(-6);
if(flag & 4)
continue;
if(!(flag & 8))
if(strncmp(names[i], "user.", 5))
continue;
return(-6);
}
if(flag & 2)
return(-6);

View File

@ -447,10 +447,26 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
continue;
}
/* Extended Attribute */
#ifdef Libisofs_aaip_linux_set_attr_list_neW
/* >>> Enable this after release 1.1.4. */
if(flag & 4)
continue;
if(!(flag & 8))
if(strncmp(names[i], "user.", 5))
continue;
#else /* Libisofs_aaip_linux_set_attr_list_neW */
/* <<< This worked well, but obviously only because bit0 is always set */
if((flag & 1) && !(flag & 8))
if(strncmp(names[i], "user.", 5))
continue;
#endif /* ! Libisofs_aaip_linux_set_attr_list_neW */
#ifdef Libisofs_with_aaip_xattR
if(flag & 32)

View File

@ -96,7 +96,7 @@ size_t aaip_encode(size_t num_attrs, char **names,
size_t *result_len, unsigned char **result, int flag)
{
size_t mem_size= 0, comp_size;
unsigned int number_of_fields, i, num_recs, total_recs= 0, ret;
unsigned int number_of_fields, i, num_recs, ret;
/* Predict memory needs, number of SUSP fields and component records */
*result_len= 0;
@ -106,7 +106,6 @@ size_t aaip_encode(size_t num_attrs, char **names,
if(ret <= 0)
return(ret);
mem_size+= comp_size;
total_recs= num_recs;
}
number_of_fields= mem_size / 250 + !!(mem_size % 250);
mem_size+= number_of_fields * 5;
@ -1702,7 +1701,7 @@ int aaip_decode_attrs(struct aaip_state **handle,
unsigned char *data, size_t num_data, size_t *consumed,
int flag)
{
int ret, was_non_aa= 0;
int ret;
struct aaip_state *aaip;
size_t h_num, *h_lengths, i, new_mem, pair_consumed= 0;
char **h_names, **h_values, *hpt;
@ -1791,7 +1790,6 @@ int aaip_decode_attrs(struct aaip_state **handle,
return(ret);
} else if(ret == -1) { /* non-AAIP field detected */
was_non_aa= 1;
if(pair_consumed <= 0)
return(-4); /* interpretation did not advance */

View File

@ -363,7 +363,7 @@ void write_one_dir_record(Ecma119Image *t, Ecma119Node *node, int file_id,
struct ecma119_dir_record *rec = (struct ecma119_dir_record*)buf;
IsoNode *iso;
len_dr = 33 + len_fi + (len_fi % 2 ? 0 : 1);
len_dr = 33 + len_fi + ((len_fi % 2) ? 0 : 1);
memcpy(rec->file_id, name, len_fi);
@ -629,7 +629,7 @@ int write_one_dir(Ecma119Image *t, Ecma119Node *dir, Ecma119Node *parent)
for (section = 0; section < nsections; ++section) {
/* compute len of directory entry */
len = fi_len + 33 + (fi_len % 2 ? 0 : 1);
len = fi_len + 33 + ((fi_len % 2) ? 0 : 1);
if (need_version_number(t, child)) {
len += 2;
}

View File

@ -275,6 +275,9 @@ int iso_tree_add_boot_node(IsoDir *parent, const char *name, IsoBoot **boot)
free(node);
return ISO_OUT_OF_MEM;
}
node->lba = 0;
node->size = 0;
node->content = NULL;
/* atributes from parent */
node->node.mode = S_IFREG | (parent->node.mode & 0444);
@ -598,6 +601,30 @@ int iso_image_get_boot_image(IsoImage *image, ElToritoBootImage **boot,
return ISO_SUCCESS;
}
int iso_image_get_bootcat(IsoImage *image, IsoBoot **catnode, uint32_t *lba,
char **content, off_t *size)
{
IsoBoot *bootcat;
*catnode = NULL;
*lba = 0;
*content = NULL;
*size = 0;
bootcat = image->bootcat->node;
if (bootcat == NULL)
return 0;
*catnode = bootcat;
*lba = bootcat->lba;
*size = bootcat->size;
if (bootcat->size > 0 && bootcat->content != NULL) {
*content = calloc(1, bootcat->size);
if (*content == NULL)
return ISO_OUT_OF_MEM;
memcpy(*content, bootcat->content, bootcat->size);
}
return 1;
}
int iso_image_get_all_boot_imgs(IsoImage *image, int *num_boots,
ElToritoBootImage ***boots, IsoFile ***bootnodes, int flag)
{
@ -760,7 +787,6 @@ write_validation_entry(uint8_t *buf, uint8_t platform_id,
static void
write_section_header(uint8_t *buf, Ecma119Image *t, int idx, int num_entries)
{
int pi;
char *id_string;
struct el_torito_section_header *e =
@ -768,7 +794,7 @@ write_section_header(uint8_t *buf, Ecma119Image *t, int idx, int num_entries)
/* 0x90 = more section headers follow , 0x91 = final section */
e->header_indicator[0] = 0x90 + (idx == t->catalog->num_bootimages - 1);
pi= e->platform_id[0] = t->catalog->bootimages[idx]->platform_id;
e->platform_id[0] = t->catalog->bootimages[idx]->platform_id;
e->num_entries[0] = num_entries & 0xff;
e->num_entries[1] = (num_entries >> 8) & 0xff;;
id_string = (char *) e->id_string;
@ -1160,7 +1186,6 @@ static
int eltorito_writer_write_vol_desc(IsoImageWriter *writer)
{
Ecma119Image *t;
struct el_torito_boot_catalog *cat;
struct ecma119_boot_rec_vol_desc vol;
if (writer == NULL) {
@ -1168,7 +1193,6 @@ int eltorito_writer_write_vol_desc(IsoImageWriter *writer)
}
t = writer->target;
cat = t->catalog;
iso_msg_debug(t->image->id, "Write El-Torito boot record");
memset(&vol, 0, sizeof(struct ecma119_boot_rec_vol_desc));

View File

@ -26,6 +26,14 @@
struct Iso_Boot
{
IsoNode node;
/* Want to get content of loaded boot catalog.
Vreixo took care not to make it an IsoFile at load time.
So this is implemented independently of IsoStream.
*/
uint32_t lba;
off_t size;
char *content;
};
/* Not more than 32 so that all entries fit into 2048 bytes */

View File

@ -293,6 +293,8 @@ typedef struct
uint32_t bootblocks[Libisofs_max_boot_imageS];
uint32_t catblock; /**< Block for El-Torito catalog */
off_t catsize; /* Size of boot catalog in bytes */
char *catcontent;
/* Whether inode numbers from PX entries shall be discarded */
unsigned int make_new_ino : 1 ;
@ -1930,7 +1932,6 @@ static
int ifs_get_by_path(IsoFilesystem *fs, const char *path, IsoFileSource **file)
{
int ret;
_ImageFsData *data;
IsoFileSource *src;
char *ptr, *brk_info, *component;
@ -1943,8 +1944,6 @@ int ifs_get_by_path(IsoFilesystem *fs, const char *path, IsoFileSource **file)
return ISO_FILE_BAD_PATH;
}
data = (_ImageFsData*)fs->data;
/* open the filesystem */
ret = ifs_fs_open((IsoImageFilesystem*)fs);
if (ret < 0) {
@ -2052,10 +2051,8 @@ int ifs_fs_close(IsoImageFilesystem *fs)
static
void ifs_fs_free(IsoFilesystem *fs)
{
IsoImageFilesystem *ifs;
_ImageFsData *data;
ifs = (IsoImageFilesystem*)fs;
data = (_ImageFsData*) fs->data;
/* close data source if already openned */
@ -2078,6 +2075,10 @@ void ifs_fs_free(IsoFilesystem *fs)
free(data->biblio_file_id);
free(data->input_charset);
free(data->local_charset);
if(data->catcontent != NULL)
free(data->catcontent);
free(data);
}
@ -2328,14 +2329,15 @@ ex:;
static
int read_el_torito_boot_catalog(_ImageFsData *data, uint32_t block)
{
int ret, i, rx, last_done, idx;
int ret, i, rx, last_done, idx, bufsize;
struct el_torito_validation_entry *ve;
struct el_torito_section_header *sh;
struct el_torito_section_entry *entry; /* also usable as default_entry */
unsigned char *buffer = NULL;
unsigned char *buffer = NULL, *rpt;
LIBISO_ALLOC_MEM(buffer, unsigned char, BLOCK_SIZE);
data->num_bootimgs = 0;
data->catsize = 0;
ret = data->src->read_block(data->src, block, buffer);
if (ret < 0) {
goto ex;
@ -2367,6 +2369,7 @@ int read_el_torito_boot_catalog(_ImageFsData *data, uint32_t block)
data->eltorito = 1;
/* The Default Entry is declared mandatory */
data->catsize = 64;
data->num_bootimgs = 1;
data->platform_ids[0] = ve->platform_id[0];
memcpy(data->id_strings[0], ve->id_string, 24);
@ -2385,10 +2388,21 @@ int read_el_torito_boot_catalog(_ImageFsData *data, uint32_t block)
for (rx = 64; (buffer[rx] & 0xfe) == 0x90 && !last_done; rx += 32) {
last_done = buffer[rx] & 1;
/* Read Section Header */
/* >>> ts B10703 : load a new buffer if needed */;
sh = (struct el_torito_section_header *) (buffer + rx);
data->catsize += 32;
for (i = 0; i < sh->num_entries[0]; i++) {
rx += 32;
data->catsize += 32;
/* >>> ts B10703 : load a new buffer if needed */;
if (data->num_bootimgs >= Libisofs_max_boot_imageS) {
/* >>> ts B10703 : need to continue rather than abort */;
ret = iso_msg_submit(data->msgid, ISO_EL_TORITO_WARN, 0,
"Too many boot images found. List truncated.");
goto after_bootblocks;
@ -2410,6 +2424,27 @@ int read_el_torito_boot_catalog(_ImageFsData *data, uint32_t block)
}
}
after_bootblocks:;
if(data->catsize > 0) {
if(data->catcontent != NULL)
free(data->catcontent);
if(data->catsize > 10 * BLOCK_SIZE)
data->catsize = 10 * BLOCK_SIZE;
bufsize = data->catsize;
if (bufsize % BLOCK_SIZE)
bufsize += BLOCK_SIZE - (bufsize % BLOCK_SIZE);
data->catcontent = calloc(bufsize , 1);
if(data->catcontent == NULL) {
data->catsize = 0;
ret = ISO_OUT_OF_MEM;
goto ex;
}
for(rx = 0; rx < bufsize; rx += BLOCK_SIZE) {
rpt = (unsigned char *) (data->catcontent + rx);
ret = data->src->read_block(data->src, block + rx / BLOCK_SIZE, rpt);
if (ret < 0)
goto ex;
}
}
ret = ISO_SUCCESS;
ex:;
LIBISO_FREE_MEM(buffer);
@ -2531,6 +2566,8 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
iso_data_source_ref(src);
data->open_count = 0;
data->catcontent = NULL;
/* get an id for the filesystem */
data->id = ++fs_dev_id;
@ -2802,9 +2839,10 @@ static
int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
IsoFileSource *src, IsoNode **node)
{
int ret, idx;
int ret, idx, to_copy;
struct stat info;
IsoNode *new;
IsoBoot *bootcat;
char *name;
char *dest = NULL;
ImageFileSourceData *data;
@ -2861,9 +2899,28 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
free(name);
goto ex;
}
bootcat = (IsoBoot *) new;
bootcat->lba = data->sections[0].block;
bootcat->size = info.st_size;
if (bootcat->size > 10 * BLOCK_SIZE)
bootcat->size = 10 * BLOCK_SIZE;
bootcat->content = NULL;
if (bootcat->size > 0) {
bootcat->content = calloc(1, bootcat->size);
if (bootcat->content == NULL) {
ret = ISO_OUT_OF_MEM;
free(name);
free(new);
goto ex;
}
to_copy = bootcat->size;
if (bootcat->size > fsdata->catsize)
to_copy = fsdata->catsize;
memcpy(bootcat->content, fsdata->catcontent, to_copy);
}
/* and set the image node */
image->bootcat->node = (IsoBoot*)new;
image->bootcat->node = bootcat;
new->type = LIBISO_BOOT;
new->refcount = 1;
} else {
@ -3276,9 +3333,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
uint8_t *rpt;
IsoFileSource *boot_src;
IsoNode *node;
uint32_t old_checksum_start_lba;
uint32_t old_checksum_end_lba;
uint32_t old_checksum_idx_count;
char *old_checksum_array = NULL;
char checksum_type[81];
uint32_t checksum_size;
@ -3328,9 +3382,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
oldroot = image->root;
oldbootcat = image->bootcat; /* could be NULL */
image->bootcat = NULL;
old_checksum_start_lba = image->checksum_start_lba;
old_checksum_end_lba = image->checksum_end_lba;
old_checksum_idx_count = image->checksum_idx_count;
old_checksum_array = image->checksum_array;
image->checksum_array = NULL;
@ -3463,11 +3514,25 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
"patching may lead to bad results.");
}
if (image->bootcat->node == NULL) {
IsoNode *node = calloc(1, sizeof(IsoBoot));
IsoNode *node;
IsoBoot *bootcat;
node = calloc(1, sizeof(IsoBoot));
if (node == NULL) {
ret = ISO_OUT_OF_MEM;
goto import_revert;
}
bootcat = (IsoBoot *) node;
bootcat->lba = data->catblock;
bootcat->size = data->catsize;
bootcat->content = NULL;
if (bootcat->size > 0) {
bootcat->content = calloc(1, bootcat->size);
if (bootcat->content == NULL) {
ret = ISO_OUT_OF_MEM;
goto import_revert;
}
memcpy(bootcat->content, data->catcontent, bootcat->size);
}
node->type = LIBISO_BOOT;
node->mode = S_IFREG;
node->refcount = 1;
@ -3572,9 +3637,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
el_torito_boot_catalog_free(image->bootcat);
image->root = oldroot;
image->bootcat = oldbootcat;
old_checksum_start_lba = image->checksum_start_lba;
old_checksum_end_lba = image->checksum_end_lba;
old_checksum_idx_count = image->checksum_idx_count;
image->checksum_array = old_checksum_array;
old_checksum_array = NULL;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 Thomas Schmitt
* Copyright (c) 2009 - 2011 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -95,13 +95,11 @@ char* lfs_get_name(IsoFileSource *src)
static
int lfs_lstat(IsoFileSource *src, struct stat *info)
{
_LocalFsFileSource *data;
char *path;
if (src == NULL || info == NULL) {
return ISO_NULL_POINTER;
}
data = src->data;
path = lfs_get_path(src);
if (path == NULL)
return ISO_OUT_OF_MEM;
@ -140,13 +138,11 @@ int lfs_lstat(IsoFileSource *src, struct stat *info)
static
int lfs_stat(IsoFileSource *src, struct stat *info)
{
_LocalFsFileSource *data;
char *path;
if (src == NULL || info == NULL) {
return ISO_NULL_POINTER;
}
data = src->data;
path = lfs_get_path(src);
if (path == NULL)
return ISO_OUT_OF_MEM;
@ -186,13 +182,11 @@ static
int lfs_access(IsoFileSource *src)
{
int ret;
_LocalFsFileSource *data;
char *path;
if (src == NULL) {
return ISO_NULL_POINTER;
}
data = src->data;
path = lfs_get_path(src);
ret = iso_eaccess(path);
@ -419,7 +413,6 @@ static
int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
{
int size, ret;
_LocalFsFileSource *data;
char *path;
if (src == NULL || buf == NULL) {
@ -430,7 +423,6 @@ int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
return ISO_WRONG_ARG_VALUE;
}
data = src->data;
path = lfs_get_path(src);
/*
@ -503,9 +495,6 @@ int lfs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
size_t num_attrs = 0, *value_lengths = NULL, result_len, sret;
char *path = NULL, **names = NULL, **values = NULL;
unsigned char *result = NULL;
_LocalFsFileSource *data;
data = src->data;
*aa_string = NULL;
@ -873,6 +862,8 @@ int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
return ISO_OUT_OF_MEM;
if (ret == -2)
return ISO_AAIP_BAD_AASTRING;
if (ret == -6 || ret == -7)
return ISO_AAIP_NOT_ENABLED;
return ISO_AAIP_NO_SET_LOCAL;
}
return 1;

View File

@ -689,7 +689,7 @@ void write_one_dir_record(Ecma119Image *t, Iso1999Node *node, int file_id,
struct ecma119_dir_record *rec = (struct ecma119_dir_record*)buf;
len_dr = 33 + len_fi + (len_fi % 2 ? 0 : 1);
len_dr = 33 + len_fi + ((len_fi % 2) ? 0 : 1);
memcpy(rec->file_id, name, len_fi);
@ -837,7 +837,7 @@ int write_one_dir(Ecma119Image *t, Iso1999Node *dir)
/* compute len of directory entry */
fi_len = strlen(child->name);
len = fi_len + 33 + (fi_len % 2 ? 0 : 1);
len = fi_len + 33 + ((fi_len % 2) ? 0 : 1);
nsections = (child->type == ISO1999_FILE) ? child->info.file->nsections : 1;
for (section = 0; section < nsections; ++section) {

View File

@ -759,7 +759,7 @@ void write_one_dir_record(Ecma119Image *t, JolietNode *node, int file_id,
struct ecma119_dir_record *rec = (struct ecma119_dir_record*)buf;
len_dr = 33 + len_fi + (len_fi % 2 ? 0 : 1);
len_dr = 33 + len_fi + ((len_fi % 2) ? 0 : 1);
memcpy(rec->file_id, name, len_fi);

View File

@ -1228,7 +1228,7 @@ int iso_lib_is_compatible(int major, int minor, int micro);
*/
#define iso_lib_header_version_major 1
#define iso_lib_header_version_minor 1
#define iso_lib_header_version_micro 0
#define iso_lib_header_version_micro 4
/**
* Usage discussion:
@ -2876,6 +2876,35 @@ int iso_image_add_boot_image(IsoImage *image, const char *image_path,
int iso_image_get_boot_image(IsoImage *image, ElToritoBootImage **boot,
IsoFile **imgnode, IsoBoot **catnode);
/**
* Get detailed information about the boot catalog that was loaded from
* an ISO image.
* The boot catalog links the El Torito boot record at LBA 17 with the
* boot images which are IsoFile objects in the image. The boot catalog
* itself is not a regular file and thus will not deliver an IsoStream.
* Its content is usually quite short and can be obtained by this call.
*
* @param image
* The image to inquire.
* @param catnode
* Will return the boot catalog tree node. No extra ref is taken.
* @param lba
* Will return the block address of the boot catalog in the image.
* @param content
* Will return either NULL or an allocated memory buffer with the
* content bytes of the boot catalog.
* Dispose it by free() when no longer needed.
* @param size
* Will return the number of bytes in content.
* @return
* 1 if reply is valid, 0 if not boot catalog was loaded, < 0 on error.
*
* @since 1.1.2
*/
int iso_image_get_bootcat(IsoImage *image, IsoBoot **catnode, uint32_t *lba,
char **content, off_t *size);
/**
* Get all El-Torito boot images of an ISO image.
*

View File

@ -88,6 +88,7 @@ iso_image_get_all_boot_imgs;
iso_image_get_application_id;
iso_image_get_attached_data;
iso_image_get_biblio_file_id;
iso_image_get_bootcat;
iso_image_get_boot_image;
iso_image_get_copyright_file_id;
iso_image_get_data_preparer_id;

View File

@ -135,7 +135,7 @@ int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag)
static int h = 64, s = 32;
int i, warn_size = 0, id;
int i, id;
char *wpt;
off_t imgsize, cylsize, frac, padding, c, cc;
@ -164,7 +164,6 @@ int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag)
*img_blocks = imgsize / (off_t) 2048;
c = imgsize / cylsize;
if (c > 1024) {
warn_size = 1;
cc = 1024;
} else
cc = c;

View File

@ -247,9 +247,8 @@ void iso_msg_debug(int imgid, const char *fmt, ...)
{
char *msg = NULL;
va_list ap;
int ret;
LIBISO_ALLOC_MEM(msg, char, MAX_MSG_LEN);
LIBISO_ALLOC_MEM_VOID(msg, char, MAX_MSG_LEN);
va_start(ap, fmt);
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
va_end(ap);

View File

@ -19,6 +19,7 @@
#include "aaip_0_2.h"
#include "messages.h"
#include "util.h"
#include "eltorito.h"
#include <stdlib.h>
@ -78,6 +79,14 @@ void iso_node_unref(IsoNode *node)
IsoSymlink *link = (IsoSymlink*) node;
free(link->dest);
}
break;
case LIBISO_BOOT:
{
IsoBoot *bootcat = (IsoBoot *) node;
if (bootcat->content != NULL)
free(bootcat->content);
}
break;
default:
/* other kind of nodes does not need to delete anything here */
break;
@ -1615,6 +1624,8 @@ int iso_aa_lookup_attr(unsigned char *aa_string, char *name,
ret = iso_aa_get_attrs(aa_string, &num_attrs, &names,
&value_lengths, &values, 0);
if (ret < 0)
return ret;
for (i = 0; i < (int) num_attrs; i++) {
if (strcmp(names[i], name))
continue;

View File

@ -683,7 +683,8 @@ static int make_sun_disk_label(Ecma119Image *t, uint8_t *buf, int flag)
ret = write_sun_partition_entry(1, t->appended_partitions,
t->appended_part_start, t->appended_part_size,
ISO_SUN_CYL_SIZE, buf, 0);
if (ret < 0)
return ret;
return ISO_SUCCESS;
}

View File

@ -924,9 +924,8 @@ uint16_t *iso_j_file_id(const uint16_t *src, int flag)
uint16_t *dot, *retval = NULL;
size_t lname, lext, lnname, lnext, pos, i, maxchar = 64;
uint16_t *dest = NULL;
int ret;
LIBISO_ALLOC_MEM(dest, uint16_t, LIBISO_JOLIET_NAME_MAX);
LIBISO_ALLOC_MEM_VOID(dest, uint16_t, LIBISO_JOLIET_NAME_MAX);
/* was: 66 = 64 (name + ext) + 1 (.) + 1 (\0) */
if (src == NULL) {
@ -1004,9 +1003,8 @@ uint16_t *iso_j_dir_id(const uint16_t *src, int flag)
{
size_t len, i, maxchar = 64;
uint16_t *dest = NULL, *retval = NULL;
int ret;
/* was: 65 = 64 + 1 (\0) */
LIBISO_ALLOC_MEM(dest, uint16_t, LIBISO_JOLIET_NAME_MAX);
LIBISO_ALLOC_MEM_VOID(dest, uint16_t, LIBISO_JOLIET_NAME_MAX);
if (src == NULL) {
goto ex;
@ -1576,12 +1574,12 @@ void strncpy_pad(char *dest, const char *src, size_t max)
if (src != NULL) {
len = MIN(strlen(src), max);
for (i = 0; i < len; ++i)
dest[i] = src[i];
} else {
len = 0;
}
for (i = 0; i < len; ++i)
dest[i] = src[i];
for (i = len; i < max; ++i)
dest[i] = ' ';
}

View File

@ -547,6 +547,12 @@ void *iso_alloc_mem(size_t size, size_t count, int flag);
ret= ISO_OUT_OF_MEM; goto ex; \
} }
#define LIBISO_ALLOC_MEM_VOID(pt, typ, count) { \
pt= (typ *) iso_alloc_mem(sizeof(typ), (size_t) (count), 0); \
if(pt == NULL) { \
goto ex; \
} }
#define LIBISO_FREE_MEM(pt) { \
if(pt != NULL) \
free((char *) pt); \