Commit 95f74efd authored by Dominique Dumont's avatar Dominique Dumont

Import Upstream version 1.4.2

parent c4410807
Vreixo Formoso <metalpain2002@yahoo.es>,
Mario Danic <mario.danic@gmail.com>,
Thomas Schmitt <scdbackup@gmx.net>
Copyright (C) 2007-2014 Vreixo Formoso, Mario Danic, Thomas Schmitt
Copyright (C) 2007-2015 Vreixo Formoso, Mario Danic, Thomas Schmitt
This program is free software; you can redistribute it and/or modify
......
libisofs-1.4.0.tar.gz Sun May 17 2014
libisofs-1.4.2.tar.gz Sat Nov 28 2015
===============================================================================
* Bug fix: zisofs compression caused SIGSEGV (by reading) with files larger
than 524160 KiB.
* Bug fix: iso_node_get_name() of root node returned NULL pointer rather than
an empty string
* Bug fix: Names read from Joliet tree where stripped of trailing ";1"
* Now sorting the data file content extents by ECMA-119 tree, rather than
by the red-black tree which shall consolidate files with identical
source object.
* New API call iso_read_opts_set_ecma119_map().
* New AAIP variable isofs.nt records name truncation parameters.
* Rectified handling of oversized filenames by new API calls:
iso_image_set_truncate_mode, iso_image_get_truncate_mode,
iso_truncate_leaf_name, iso_image_set_node_name, iso_image_tree_clone,
iso_image_add_new_dir, iso_image_add_new_file, iso_image_add_new_special,
iso_image_add_new_symlink, iso_image_dir_get_node, iso_image_path_to_node
* Result of a Coverity audit: 50+ code changes, but no easy-to-trigger bugs
libisofs-1.4.0.tar.gz Sun May 17 2015
===============================================================================
* Bug fix: iso_image_report_system_area() caused SIGSEGV by NULL if no valid
ISO 9660 image was loeaded. Thanks to OmegaPhil.
......@@ -19,7 +39,7 @@ libisofs-1.4.0.tar.gz Sun May 17 2014
* Bug fix: A zero sized GPT partition was marked after the last appended
GPT partition.
* Bug fix: GPT production did not yield proper results with appended sessions
resp. with TOC emulation enabled.
or with TOC emulation enabled.
* Increased default weight of El Torito boot catalog to 1 billion.
* Improved handling of cylinder alignment if the resulting image size is not
divisible by 2048. Old behavior was to not align. New is to pad up by a
......@@ -33,7 +53,6 @@ libisofs-1.4.0.tar.gz Sun May 17 2014
iso_write_opts_set_prep_img(), iso_write_opts_set_efi_bootp(),
and iso_write_opts_set_partition_img().
libisofs-1.3.8.tar.gz Sat Jun 28 2014
===============================================================================
* Bug fix: Prevent allocation of empty hash tables. Thanks Richard Nolde.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,7 +4,7 @@
Released under GPL (see COPYING file for details).
Copyright (C) 2008 - 2013 Vreixo Formoso,
Copyright (C) 2008 - 2015 Vreixo Formoso,
Mario Danic,
Vladimir Serbinenko,
Thomas Schmitt
......@@ -37,7 +37,7 @@ and execute
./configure --prefix=/usr
make
To make the libraries accessible for running resp. developing applications
To make the libraries accessible for running and developing applications
make install
On GNU/Linux it will try to run program ldconfig with the library installation
......
This diff is collapsed.
This diff is collapsed.
AC_INIT([libisofs], [1.4.0], [http://libburnia-project.org])
AC_INIT([libisofs], [1.4.2], [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=4
LIBISOFS_MICRO_VERSION=0
LIBISOFS_MICRO_VERSION=2
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
# 2015.05.17 development jump has not yet happened
# SONAME = 82 - 76 = 6 . Library name = libisofs.6.76.0
LT_CURRENT=82
LT_AGE=76
# 2015.11.28 development jump has not yet happened
# SONAME = 84 - 78 = 6 . Library name = libisofs.6.78.0
LT_CURRENT=84
LT_AGE=78
LT_REVISION=0
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
......
This diff is collapsed.
......@@ -217,7 +217,7 @@ S_IRWXG. If there is ACL_USER_N or ACL_GROUP_N there must also be ACL_MASK.
A numeric qualifier is a binary number of variable length up to 4 bytes. The
Most Significant Byte comes first. The number shall be the "POSIX File User ID"
resp. "POSIX File Group ID" as also used in RRIP PX entries. The ids of owning
or "POSIX File Group ID" as also used in RRIP PX entries. The ids of owning
user and owning group shall be taken from the PX entry of the file object.
Optional TRANSLATE entries may associate user or group names with numeric
......
......@@ -8,7 +8,9 @@
The following names are defined for AAIP namespace "isofs." as mentioned in
specification of AAIP :
specification of AAIP. Unless explicitly stated otherwise, numbers with
names like *_LEN are 8 bit unsigned integers, those with *_BYTES are 32 bit
unsigned integers.
-------------------------------------------------------------------------------
......@@ -22,7 +24,7 @@ Purpose:
END is also the block address of the start of the checksum recording
area in the image.
See also isofs.cx .
This attribute shall eventually be attached to the root directory entry
This attribute shall be attached to the root directory entry
and be global for the whole image.
Format of Value:
......@@ -65,8 +67,8 @@ Purpose:
Records the name of the character set that was used as output character
set when writing the RRIP name tree of the ISO 9660 image. It shall be
suitable as parameter for function iconv_open(3).
This attribute shall eventually be attached to the root directory entry
and be global for the whole image.
This attribute shall be attached to the root directory entry and be
global for the whole image.
Format of Value:
Shall hold the character set name without terminating 0-byte.
......@@ -107,6 +109,7 @@ Name:
Purpose:
Records .st_dev and .st_ino of struct stat of the file source in the
local filesystem. See man 2 stat.
Both values may be unsigned integers up to 255 bytes.
Format of Value:
DEV_LEN | DEV_BYTES | INO_LEN | INO_BYTES
......@@ -172,6 +175,26 @@ Registered:
-------------------------------------------------------------------------------
Name:
isofs.nt
Purpose:
Records the name truncation mode and the truncation length for Rock Ridge
names. See iso_image_set_truncate_mode() in libisofs.h.
This attribute shall be attached to the root directory entry and be
global for the whole image.
Format of Value:
MODE_LEN | MODE_BYTES | LENGTH_LEN | LENGTH_BYTES
Example:
{ 1, 1, 1, 255 }
Registered:
24 Sep 2015 by Thomas Schmitt for libisofs.
-------------------------------------------------------------------------------
Name:
isofs.st
......@@ -183,7 +206,7 @@ Purpose:
The RRIP timestamps have a blind second during which a change after
node registration would not be recognizable for incremental backups
which are based in "isofs.di" rather than on content comparison.
This attribute shall eventually be attached to the root directory entry
This attribute shall be attached to the root directory entry
and be global for the whole image.
Format of Value:
......
......@@ -37,7 +37,7 @@ i.e. block sizes 32 kB, 64 kB, and 128 kB. Writers must not use other sizes.
Block Pointers
There are ceil(input_size / block_size) input resp. output blocks.
There are ceil(input_size / block_size) input and output blocks.
Each input block is of fixed size whereas the output blocks have varying
size (down to 0). For each output block there is an offset pointer giving
its byte address in the overall file content. The next block pointer in the
......@@ -68,7 +68,7 @@ when being read.
ZF may only be applied to files with a single extent and less than 4 GiB of
uncompressed size.
The ZF entry follows the general layout of SUSP resp. RRIP.
The ZF entry follows the general layout of SUSP and RRIP.
Its fields are:
[1] "BP 1 to BP 2 - Signature Word" shall be (5A)(46) ("ZF").
......@@ -85,19 +85,18 @@ Its fields are:
[5] "BP 7 - Header Size Div 4" shall specify as an 8-bit number the number of
4-byte words in the header part of the file data recorded according
to ISO 9660:7.1.1.
(This is a copy of header byte 12, resp. header BP 13).
(This is a copy of header byte 12 / BP 13).
[6] "BP 8 - Log2 of Block Size" shall specify as an 8-bit number the binary
logarithm of the compression block size recorded according to
ISO 9660:7.1.1.
(This is a copy of header byte 13, resp. header BP 14.
(This is a copy of header byte 13 / BP 14.
The value has to be 15, 16 or 17 i.e. 32 kiB, 64 kiB, or 128 kiB.)
[7] "BP 9 to BP 16 - Uncompressed Size" shall tell the number of uncompressed
bytes represented by the given extent. This field shall be recorded
according to ISO 9660:7.3.3.
(This number is the same as in header bytes 8 to 11, resp header BP 9
to BP 12.)
(This number is the same as in header bytes 8 to 11 / BP 9 to BP 12.)
| 'Z' | 'F' | LENGTH | 1 | 'p' | 'z' | HEADER SIZE DIV 4 | LOG2 BLOCK SIZE
| UNCOMPRESSED SIZE |
......
......@@ -39,7 +39,7 @@
It is permissibile to set them to 1 already now.
bit8 and higher: reserved, submit 0
@return
Bitfield corresponding to flag. If bits are set, th
Bitfield corresponding to flag.
bit0= ACL adapter is enabled
bit1= xattr adapter is enabled
bit2 - bit7= Reserved for future types.
......
......@@ -49,7 +49,7 @@
It is permissibile to set them to 1 already now.
bit8 and higher: reserved, submit 0
@return
Bitfield corresponding to flag. If bits are set, th
Bitfield corresponding to flag.
bit0= ACL adapter is enabled
bit1= xattr adapter is enabled
bit2 - bit7= Reserved for future types.
......@@ -687,7 +687,7 @@ ex:;
0 no suitable ACL manipulation adapter available
-1 failure of system ACL service (see errno)
-2 attempt to manipulate ACL of a symbolic link
without bit5 resp. with no suitable link target
without bit5 or with no suitable link target
*/
int aaip_set_acl_text(char *path, char *text, int flag)
{
......
......@@ -89,7 +89,7 @@ int aaip_local_attr_support(int flag)
or filesystem does not support ACL
-1 failure of system ACL service (see errno)
-2 attempt to inquire ACL of a symbolic link without
bit4 or bit5 resp. with no suitable link target
bit4 or bit5 or with no suitable link target
*/
int aaip_get_acl_text(char *path, char **text, int flag)
{
......@@ -186,16 +186,20 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
size_t **value_lengths, char ***values, int flag)
{
int ret;
ssize_t i, num_names= 0;
#ifdef Libisofs_with_aaip_acL
unsigned char *acl= NULL;
char *a_acl_text= NULL, *d_acl_text= NULL;
size_t acl_len= 0;
#define Libisofs_aaip_get_attr_activE yes
#endif
#ifdef Libisofs_with_aaip_xattR
char *list= NULL;
ssize_t value_ret, retry= 0, list_size= 0;
#define Libisofs_aaip_get_attr_activE yes
#endif
#ifdef Libisofs_aaip_get_attr_activE
ssize_t i, num_names= 0;
#endif
if(flag & (1 << 15)) { /* Free memory */
......@@ -207,6 +211,14 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
*value_lengths= NULL;
*values= NULL;
#ifndef Libisofs_aaip_get_attr_activE
ret = 1;
ex:;
return ret;
#else /* Libisofs_aaip_get_attr_activE */
/* Set up arrays */
#ifdef Libisofs_with_aaip_xattR
......@@ -361,6 +373,9 @@ ex:;
*num_attrs= 0;
}
return(ret);
#endif /* Libisofs_aaip_get_attr_activE */
}
......@@ -377,7 +392,7 @@ ex:;
0 ACL support not enabled at compile time
-1 failure of system ACL service (see errno)
-2 attempt to manipulate ACL of a symbolic link
without bit5 resp. with no suitable link target
without bit5 or with no suitable link target
*/
int aaip_set_acl_text(char *path, char *text, int flag)
{
......@@ -444,12 +459,18 @@ ex:
int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
size_t *value_lengths, char **values, int flag)
{
int ret, has_default_acl= 0;
size_t i, consumed, acl_text_fill, acl_idx= 0, h_consumed;
char *acl_text= NULL, *list= NULL;
int ret;
size_t i, consumed, acl_text_fill, acl_idx= 0;
char *acl_text= NULL;
#ifdef Libisofs_with_aaip_xattR
char *list= NULL;
ssize_t list_size= 0;
#endif
#ifdef Libisofs_with_aaip_acL
size_t h_consumed;
int has_default_acl= 0;
#endif
#ifdef Libisofs_with_aaip_xattR
......@@ -539,15 +560,14 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
goto ex;
if(ret <= 0)
{ret= -2; goto ex;}
has_default_acl= (ret == 2);
#ifdef Libisofs_with_aaip_acL
has_default_acl= (ret == 2);
ret= aaip_set_acl_text(path, acl_text, flag & 32);
if(ret <= 0)
{ret= -3; goto ex;}
#else
{ret= -7; goto ex;}
#endif
/* "default" ACL */
if(has_default_acl) {
free(acl_text);
......@@ -582,11 +602,22 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
}
}
ret= 1;
#else
ret= -7;
#endif /* !Libisofs_with_aaip_acL */
ex:;
if(acl_text != NULL)
free(acl_text);
#ifdef Libisofs_with_aaip_xattR
if(list != NULL)
free(list);
#endif
return(ret);
}
......
......@@ -7,7 +7,7 @@
See libisofs/aaip_0_2.h
http://libburnia-project.org/wiki/AAIP
Copyright (c) 2009 - 2014 Thomas Schmitt, libburnia project, GPLv2+
Copyright (c) 2009 - 2015 Thomas Schmitt, libburnia project, GPLv2+
*/
......@@ -62,12 +62,12 @@
#define Aaip_namespace_trusteD 0x05
#define Aaip_namespace_securitY 0x06
static char Aaip_namespace_textS[][16]= {"", "", "system.", "user.", "isofs.",
"trusted.", "security."};
/* maximum expansion: "security." */
#define Aaip_max_name_expansioN 9
static char Aaip_namespace_textS[][Aaip_max_name_expansioN + 1]=
{"", "", "system.", "user.", "isofs.", "trusted.", "security."};
/* --------------------------------- Encoder ---------------------------- */
......@@ -88,26 +88,30 @@ static int aaip_encode_pair(char *name, size_t attr_length, char *attr,
no longer needed
@param flag Bitfield for control purposes
bit0= set CONTINUE bit of last AAIP field to 1
@return >0 is the number of SUSP fields generated,
0 means error
@return >= 0 is the number of SUSP fields generated,
< 0 means error
*/
size_t aaip_encode(size_t num_attrs, char **names,
size_t *value_lengths, char **values,
size_t *result_len, unsigned char **result, int flag)
ssize_t aaip_encode(size_t num_attrs, char **names,
size_t *value_lengths, char **values,
size_t *result_len, unsigned char **result, int flag)
{
size_t mem_size= 0, comp_size, ret;
size_t mem_size= 0, comp_size;
ssize_t ret;
unsigned int number_of_fields, i, num_recs;
/* Predict memory needs, number of SUSP fields and component records */
*result = NULL;
*result_len= 0;
for(i= 0; i < num_attrs; i++) {
ret= aaip_encode_pair(names[i], value_lengths[i], values[i],
&num_recs, &comp_size, NULL, (size_t) 0, 1);
if(ret <= 0)
if(ret < 0)
return(ret);
mem_size+= comp_size;
}
number_of_fields= mem_size / 250 + !!(mem_size % 250);
if(number_of_fields == 0)
return(0);
mem_size+= number_of_fields * 5;
#ifdef Aaip_encode_debuG
......@@ -118,14 +122,18 @@ size_t aaip_encode(size_t num_attrs, char **names,
#endif
if(*result == NULL)
return 0;
return ISO_OUT_OF_MEM;
/* Encode pairs into result */
for(i= 0; i < num_attrs; i++) {
ret= aaip_encode_pair(names[i], value_lengths[i], values[i],
&num_recs, &comp_size, *result, *result_len, 0);
if(ret <= 0)
if(ret < 0) {
free(*result);
*result = NULL;
*result_len = 0;
return(ret);
}
(*result_len)+= comp_size;
}
......@@ -404,7 +412,8 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
/* >>> Duplicate u:: entry. */;
/* >>> ??? If it matches the previous one: ignore */
return((int) ISO_AAIP_ACL_MULT_OBJ);
ret = ISO_AAIP_ACL_MULT_OBJ;
goto ex;
}
has_u++;
} else {
......@@ -449,7 +458,8 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
/* >>> Duplicate g:: entry. */;
/* >>> ??? If it matches the previous one: ignore */
return((int) ISO_AAIP_ACL_MULT_OBJ);
ret = ISO_AAIP_ACL_MULT_OBJ;
goto ex;
}
has_g++;
} else {
......@@ -493,7 +503,8 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
/* >>> Duplicate o:: entry. */;
/* >>> ??? If it matches the previous one: ignore */
return((int) ISO_AAIP_ACL_MULT_OBJ);
ret = ISO_AAIP_ACL_MULT_OBJ;
goto ex;
}
has_o++;
} else if(strncmp(rpt, "mask:", 5) == 0) {
......@@ -1803,8 +1814,8 @@ int aaip_decode_attrs(struct aaip_state **handle,
if(aaip->list_mem_used >= memory_limit)
return(3);
aaip->list_mem_used+= new_mem;
aaip->name_buf= calloc(sizeof(char *), Aaip_initial_name_leN);
aaip->value_buf= calloc(sizeof(char *), Aaip_initial_value_leN);
aaip->name_buf= calloc(1, Aaip_initial_name_leN);
aaip->value_buf= calloc(1, Aaip_initial_value_leN);
if(aaip->name_buf == NULL || aaip->value_buf == NULL)
return(-1);
aaip->name_buf_size= Aaip_initial_name_leN;
......
......@@ -30,12 +30,12 @@
no longer needed
@param flag Bitfield for control purposes
bit0= set CONTINUE bit of last AAIP field to 1
@return >0 is the number of SUSP fields generated,
0 means error
@return >= 0 is the number of SUSP fields generated,
< 0 means error
*/
size_t aaip_encode(size_t num_attrs, char **names,
size_t *value_lengths, char **values,
size_t *result_len, unsigned char **result, int flag);
ssize_t aaip_encode(size_t num_attrs, char **names,
size_t *value_lengths, char **values,
size_t *result_len, unsigned char **result, int flag);
/* ------ ACL representation ------ */
......
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2014 Thomas Schmitt
* Copyright (c) 2009 - 2015 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
......@@ -21,6 +21,7 @@
#include "image.h"
#include "aaip_0_2.h"
#include "util.h"
#include "messages.h"
#include <stdlib.h>
#include <string.h>
......@@ -72,8 +73,15 @@ int default_create_file(IsoNodeBuilder *builder, IsoImage *image,
iso_file_source_ref(src);
name = iso_file_source_get_name(src);
if (strlen(name) > LIBISOFS_NODE_NAME_MAX)
name[LIBISOFS_NODE_NAME_MAX] = 0;
if ((int) strlen(name) > image->truncate_length) {
ret = iso_truncate_rr_name(image->truncate_mode,
image->truncate_length, name, 0);
if (ret < 0) {
iso_stream_unref(stream);
free(name);
return ret;
}
}
ret = iso_node_new_file(name, stream, &node);
if (ret < 0) {
iso_stream_unref(stream);
......@@ -98,11 +106,11 @@ static
int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
IsoFileSource *src, char *in_name, IsoNode **node)
{
int ret;
int ret, name_is_attached = 0;
struct stat info;
IsoNode *new;
IsoFilesystem *fs;
char *name;
char *name = NULL;
unsigned char *aa_string = NULL;
char *a_text = NULL, *d_text = NULL;
char *dest = NULL;
......@@ -131,8 +139,12 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
}
}
if (strlen(name) > LIBISOFS_NODE_NAME_MAX)
name[LIBISOFS_NODE_NAME_MAX] = 0;
if ((int) strlen(name) > image->truncate_length) {
ret = iso_truncate_rr_name(image->truncate_mode,
image->truncate_length, name, 0);
if (ret < 0)
goto ex;
}
fs = iso_file_source_get_filesystem(src);
new = NULL;
......@@ -203,12 +215,14 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
}
}
break;
default:
ret = ISO_BAD_FSRC_FILETYPE;
goto ex;
}
if (ret < 0) {
free(name);
if (ret < 0)
goto ex;
}
name_is_attached = 1;
/* fill fields */
iso_node_set_perms_internal(new, info.st_mode, 1);
......@@ -222,9 +236,9 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
/* Eventually set S_IRWXG from ACL */
if (image->builder_ignore_acl) {
ret = iso_file_source_get_aa_string(src, &aa_string, 4);
if (aa_string != NULL)
if (ret >= 0 && aa_string != NULL)
iso_aa_get_acl_text(aa_string, info.st_mode, &a_text, &d_text, 16);
if (a_text != NULL) {
if (ret >= 0 && a_text != NULL) {
aaip_cleanout_st_mode(a_text, &(info.st_mode), 4 | 16);
iso_node_set_perms_internal(new, info.st_mode, 1);
}
......@@ -251,6 +265,8 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
ret = ISO_SUCCESS;
ex:;
if (name != NULL && !name_is_attached)
free(name);
LIBISO_FREE_MEM(dest);
return ret;
}
......
......@@ -88,6 +88,8 @@ void ecma119_image_free(Ecma119Image *t)
iso_image_unref(t->image);
if (t->files != NULL)
iso_rbtree_destroy(t->files, iso_file_src_free);
if (t->ecma119_hidden_list != NULL)
iso_filesrc_list_destroy(&(t->ecma119_hidden_list));
if (t->buffer != NULL)
iso_ring_buffer_free(t->buffer);
......@@ -1562,7 +1564,7 @@ int iso_ivr_read_number(char *start_pt, char *end_pt, off_t *result, int flag)
txt[end_pt - start_pt] = 0;
num = iso_scanf_io_size(start_pt, 1 | (flag & 2));
if (num < 0.0 || num > 0xffffffffffff) {
if (num < 0.0 || num > 281474976710655.0) {
iso_msg_submit(-1, ISO_MALFORMED_READ_INTVL, 0,
"Negative or overly large number in interval reader description string");
return ISO_MALFORMED_READ_INTVL;
......@@ -1995,7 +1997,7 @@ int iso_write_partition_file(Ecma119Image *target, char *path,
off_t byte_count;
FILE *fp = NULL;
uint32_t i, intvl_blocks;
uint32_t i;
uint8_t *buf = NULL;
int ret;
......@@ -2011,7 +2013,6 @@ int iso_write_partition_file(Ecma119Image *target, char *path,
&ivr, &byte_count, 0);
if (ret < 0)
goto ex;
intvl_blocks = (byte_count + BLOCK_SIZE - 1) / BLOCK_SIZE;
for (i = 0; i < blocks; i++) {
ret = iso_interval_reader_read(ivr, buf, &buf_fill, 0);
if (ret < 0)
......@@ -2036,7 +2037,8 @@ int iso_write_partition_file(Ecma119Image *target, char *path,
}
ret = iso_write(target, buf, BLOCK_SIZE);
if (ret < 0) {
fclose(fp);
if (fp != NULL)
fclose(fp);
goto ex;
}
}
......@@ -2344,6 +2346,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
if (ret < 0) {
goto target_cleanup;
}
target->ecma119_hidden_list = NULL;
target->image = src;
iso_image_ref(src);
......@@ -2396,10 +2399,14 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
sa_type = (system_area_options >> 2) & 0x3f;
if (sa_type != 0 && sa_type != 3)
for (i = 0; i < ISO_MAX_PARTITIONS; i++)
if (opts->appended_partitions[i] != NULL)
return ISO_NON_MBR_SYS_AREA;
if (sa_type != 0 && opts->prep_partition != NULL)
return ISO_NON_MBR_SYS_AREA;
if (opts->appended_partitions[i] != NULL) {
ret = ISO_NON_MBR_SYS_AREA;
goto target_cleanup;
}
if (sa_type != 0 && opts->prep_partition != NULL) {
ret = ISO_NON_MBR_SYS_AREA;
goto target_cleanup;
}
target->system_area_data = NULL;
if (system_area != NULL) {
......@@ -2534,6 +2541,12 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
break;
}
ret = iso_root_set_isofsnt((IsoNode *) (src->root),
(uint32_t) src->truncate_mode,
(uint32_t) src->truncate_length, 0);
if (ret < 0)
goto target_cleanup;
/*
* 2. Based on those options, create needed writers: iso, joliet...
* Each writer inits its structures and stores needed info into
......@@ -3414,8 +3427,7 @@ int iso_write_opts_clone(IsoWriteOpts *in, IsoWriteOpts **out, int flag)
return ISO_SUCCESS;
out_of_mem:;
if (o != NULL)
iso_write_opts_free(o);
iso_write_opts_free(o);
return ISO_OUT_OF_MEM;
}
......@@ -4253,3 +4265,83 @@ ex:
}
static
void ecma119_filesrc_array(Ecma119Node *dir,
int (*include_item)(void *),
IsoFileSrc **filelist, size_t *size, int just_count)
{
size_t i;
Ecma119Node *child;
for (i = 0; i < dir->info.dir->nchildren; i++) {
child = dir->info.dir->children[i];
if (child->type == ECMA119_DIR) {
ecma119_filesrc_array(child, include_item, filelist, size,
just_count);
} else if (child->type == ECMA119_FILE) {
if (include_item != NULL)
if (!include_item((void *) child->info.file))
continue;
if (just_count) {
(*size)++;
} else {
if (!child->info.file->taken) {
filelist[*size] = child->info.file;
child->info.file->taken = 1;
(*size)++;
}
}
}
}
}