If needed, add version number to symlinks and special files too.
This commit is contained in:
parent
bf0c1dd219
commit
d954957d83
@ -44,6 +44,22 @@ void ecma119_image_free(Ecma119Image *t)
|
||||
free(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we should add version number ";" to the given node name.
|
||||
*/
|
||||
static
|
||||
int need_version_number(Ecma119Image *t, Ecma119Node *n)
|
||||
{
|
||||
if (t->omit_version_numbers) {
|
||||
return 0;
|
||||
}
|
||||
if (n->type == ECMA119_DIR || n->type == ECMA119_PLACEHOLDER) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the size of a directory entry for a single node
|
||||
*/
|
||||
@ -51,7 +67,7 @@ static
|
||||
size_t calc_dirent_len(Ecma119Image *t, Ecma119Node *n)
|
||||
{
|
||||
int ret = n->iso_name ? strlen(n->iso_name) + 33 : 34;
|
||||
if (n->type == ECMA119_FILE && !t->omit_version_numbers) {
|
||||
if (need_version_number(t, n)) {
|
||||
ret += 2; /* take into account version numbers */
|
||||
}
|
||||
if (ret % 2) ret++;
|
||||
@ -213,7 +229,7 @@ void write_one_dir_record(Ecma119Image *t, Ecma119Node *node, int file_id,
|
||||
|
||||
memcpy(rec->file_id, name, len_fi);
|
||||
|
||||
if (node->type == ECMA119_FILE && !t->omit_version_numbers) {
|
||||
if (need_version_number(t, node)) {
|
||||
len_dr += 2;
|
||||
rec->file_id[len_fi++] = ';';
|
||||
rec->file_id[len_fi++] = '1';
|
||||
@ -294,13 +310,15 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer)
|
||||
vol.vol_desc_type[0] = 1;
|
||||
memcpy(vol.std_identifier, "CD001", 5);
|
||||
vol.vol_desc_version[0] = 1;
|
||||
if (system_id)
|
||||
if (system_id) {
|
||||
strncpy((char*)vol.system_id, system_id, 32);
|
||||
else
|
||||
} else {
|
||||
/* put linux by default? */
|
||||
memcpy(vol.system_id, "LINUX", 5);
|
||||
if (vol_id)
|
||||
memcpy(vol.system_id, "LINUX", 5);
|
||||
}
|
||||
if (vol_id) {
|
||||
strncpy((char*)vol.volume_id, vol_id, 32);
|
||||
}
|
||||
iso_bb(vol.vol_space_size, t->vol_space_size, 4);
|
||||
iso_bb(vol.vol_set_size, 1, 2);
|
||||
iso_bb(vol.vol_seq_number, 1, 2);
|
||||
|
@ -410,9 +410,6 @@ int mangle_single_dir(Ecma119Image *img, Ecma119Node *dir, int max_file_len,
|
||||
* Note that we don't need to check for placeholders, as
|
||||
* tree reparent happens later, so no placeholders can be
|
||||
* here at this time.
|
||||
*
|
||||
* TODO !!! Well, we will need a way to mangle root names
|
||||
* if we do reparent!
|
||||
*/
|
||||
int extlen;
|
||||
full_name[dot - full_name] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user