* This file is part of wimlib, a library for working with WIM files.
*
* wimlib is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
+ * terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
- * You should have received a copy of the GNU Lesser General Public License
+ * You should have received a copy of the GNU General Public License
* along with wimlib; if not, see http://www.gnu.org/licenses/.
*/
/* Frees a link group table. */
void free_link_group_table(struct link_group_table *table)
{
- struct link_group *single, *next;
-
if (table) {
if (table->array)
for (size_t i = 0; i < table->capacity; i++)
}
}
-u64 assign_link_group_ids_to_list(struct link_group *group, u64 id,
- struct link_group **extra_groups)
+static u64
+assign_link_group_ids_to_list(struct link_group *group, u64 id,
+ struct link_group **extra_groups)
{
struct dentry *dentry;
struct list_head *cur_head;
u64 last_ctime = 0;
u64 last_mtime = 0;
u64 last_atime = 0;
+ bool found_short_name = false;
dentry = first_dentry;
do {
if (!ref_dentry || ref_dentry->num_ads == 0)
ref_dentry = dentry;
+ if (dentry->short_name_len) {
+ if (found_short_name) {
+ ERROR("Multiple short names in hard link "
+ "group!");
+ inconsistent_link_group(first_dentry);
+ return WIMLIB_ERR_INVALID_DENTRY;
+ } else {
+ found_short_name = true;
+ }
+ }
if (dentry->creation_time > last_ctime)
last_ctime = dentry->creation_time;
if (dentry->last_write_time > last_mtime)
int ret;
size_t num_true_link_groups;
struct list_head *head;
- u64 link_group_id;
LIST_HEAD(dentries_with_data_streams);
LIST_HEAD(dentries_with_no_data_streams);
* link group to be a true link group */
if (list_empty(&dentries_with_data_streams)) {
#ifdef ENABLE_DEBUG
- DEBUG("Found link group of size %zu without any data streams:",
- dentry_link_group_size(dentry));
- print_dentry_list(dentry);
- DEBUG("We are going to interpret it as true link group, provided "
- "that the dentries are consistent.");
+ {
+ size_t size = dentry_link_group_size(dentry);
+ if (size > 1) {
+ DEBUG("Found link group of size %zu without "
+ "any data streams:", size);
+ print_dentry_list(dentry);
+ DEBUG("We are going to interpret it as true "
+ "link group, provided that the dentries "
+ "are consistent.");
+ }
+ }
#endif
return fix_true_link_group(container_of(group->dentry_list,
struct dentry,
ERROR("Out of memory");
return WIMLIB_ERR_NOMEM;
}
- group->link_group_id = link_group_id;
+ group->link_group_id = dentry->link_group_id;
group->dentry_list = &dentry->link_group_list;
group->next = *new_groups;
*new_groups = group;