#endif
/* Translate the timestamps into something readable */
- time_t creat_time = wim_timestamp_to_unix(dentry->creation_time);
- time_t access_time = wim_timestamp_to_unix(dentry->last_access_time);
- time_t mod_time = wim_timestamp_to_unix(dentry->last_write_time);
-
time = wim_timestamp_to_unix(dentry->creation_time);
p = asctime(gmtime(&time));
*(strrchr(p, '\n')) = '\0';
}
dentry->ads_entries_status = ADS_ENTRIES_USER;
}
- struct list_head *next;
list_del(&dentry->link_group_list);
free_dentry(dentry);
}
ret = get_names(&dentry->file_name, &dentry->file_name_utf8,
&dentry->file_name_len, &dentry->file_name_utf8_len,
new_name);
+ FREE(dentry->short_name);
+ dentry->short_name_len = 0;
if (ret == 0)
dentry->length = dentry_correct_length(dentry);
return ret;
u64 length_no_padding;
u64 total_length;
size_t utf8_len;
- const char *p_save = p;
+ const u8 *p_save = p;
/* Read the base stream entry, excluding the stream name. */
if (remaining_size < WIM_ADS_ENTRY_DISK_SIZE) {
if (remaining_size < length_no_padding) {
ERROR("Stream entries go past end of metadata resource");
ERROR("(remaining_size = %"PRIu64" bytes, "
- "length_no_padding = %"PRIu16" bytes)",
+ "length_no_padding = %"PRIu64" bytes)",
remaining_size, length_no_padding);
ret = WIMLIB_ERR_INVALID_DENTRY;
goto out_free_ads_entries;
char *short_name = NULL;
u16 short_name_len;
u16 file_name_len;
- size_t file_name_utf8_len;
+ size_t file_name_utf8_len = 0;
int ret;
dentry_common_init(dentry);
/* Make sure there is only one un-named stream. */
unsigned num_unnamed_streams = 0;
- unsigned unnamed_stream_idx;
for (unsigned i = 0; i <= dentry->num_ads; i++) {
const u8 *hash;
hash = dentry_stream_hash_unresolved(dentry, i);
- if (!dentry_stream_name_len(dentry, i) && !is_zero_hash(hash)) {
+ if (!dentry_stream_name_len(dentry, i) && !is_zero_hash(hash))
num_unnamed_streams++;
- unnamed_stream_idx = i;
- }
}
if (num_unnamed_streams > 1) {
ERROR("Dentry `%s' has multiple (%u) un-named streams",
goto out;
}
+ /* Cannot have a short name but no long name */
+ if (dentry->short_name_len && !dentry->file_name_len) {
+ ERROR("Dentry `%s' has a short name but no long name",
+ dentry->full_path_utf8);
+ goto out;
+ }
+
+ /* Make sure root dentry is unnamed */
+ if (dentry_is_root(dentry)) {
+ if (dentry->file_name_len) {
+ ERROR("The root dentry is named `%s', but it must "
+ "be unnamed", dentry->file_name_utf8);
+ goto out;
+ }
+ }
+
#if 0
/* Check timestamps */
if (dentry->last_access_time < dentry->creation_time ||
static u8 *write_dentry(const struct dentry *dentry, u8 *p)
{
u8 *orig_p = p;
- unsigned padding;
const u8 *hash;
/* We calculate the correct length of the dentry ourselves because the
* extracted in the way that they appear in the WIM. */
int out_fd;
- const struct resource_entry *res_entry;
int ret;
const struct list_head *head = &dentry->link_group_list;
/* 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;
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;
const u8 *sha1sums, int show_progress,
int *status)
{
- char *chunk_buf;
+ u8 *chunk_buf;
u8 resblock[SHA1_HASH_SIZE];
u64 bytes_remaining;
size_t bytes_to_read;
{
struct resource_entry *res_entry;
- int ctype;
u8 *buf = NULL;
int ret;
u32 integrity_table_size;
u64 bytes_remaining;
u8 *buf;
u8 *p;
- char *chunk_buf;
+ u8 *chunk_buf;
u32 num_entries;
u32 integrity_table_size;
int ret;
case RESOURCE_IN_STAGING_FILE:
printf("Staging File = `%s'\n", lte->staging_file_name);
break;
+ default:
+ break;
}
putchar('\n');
}
struct dentry *dentry;
struct lookup_table_entry *lte;
unsigned stream_idx;
- const char *stream_name;
+ const char *stream_name = NULL;
char *p = NULL;
if (lookup_flags & LOOKUP_FLAG_ADS_OK) {
static inline struct lookup_table_entry *
dentry_unnamed_lte_resolved(const struct dentry *dentry)
{
- struct lookup_table_entry *lte;
wimlib_assert(dentry->resolved);
-
for (unsigned i = 0; i <= dentry->num_ads; i++)
if (dentry_stream_name_len(dentry, i) == 0 &&
!is_zero_hash(dentry_stream_hash_resolved(dentry, i)))
dentry_unnamed_lte_unresolved(const struct dentry *dentry,
const struct lookup_table *table)
{
- struct lookup_table_entry *lte;
wimlib_assert(!dentry->resolved);
-
for (unsigned i = 0; i <= dentry->num_ads; i++)
if (dentry_stream_name_len(dentry, i) == 0 &&
!is_zero_hash(dentry_stream_hash_unresolved(dentry, i)))
int ret = 0;
int (*stat_fn)(const char *restrict, struct stat *restrict);
struct dentry *root;
+ const char *filename;
if (exclude_path(root_disk_path, config, true)) {
if (add_flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE)
}
if (!S_ISREG(root_stbuf.st_mode) && !S_ISDIR(root_stbuf.st_mode)
&& !S_ISLNK(root_stbuf.st_mode)) {
- ERROR("`%s' is not a regular file, directory, or symbolic link.");
+ ERROR("`%s' is not a regular file, directory, or symbolic link.",
+ root_disk_path);
return WIMLIB_ERR_SPECIAL_FILE;
}
- root = new_dentry(path_basename(root_disk_path));
+ if (add_flags & WIMLIB_ADD_IMAGE_FLAG_ROOT)
+ filename = "";
+ else
+ filename = path_basename(root_disk_path);
+
+ root = new_dentry(filename);
if (!root)
return WIMLIB_ERR_NOMEM;
closedir(dir);
} else if (dentry_is_symlink(root)) {
/* Archiving a symbolic link */
- size_t symlink_buf_len;
char deref_name_buf[4096];
ssize_t deref_name_len;
*
* @w: The WIMStruct for the WIM file.
* @root_dentry: The root of the directory tree for the image.
+ * @sd: The security data for the image.
*/
static int add_new_dentry_tree(WIMStruct *w, struct dentry *root_dentry,
struct wim_security_data *sd)
lgt = new_link_group_table(9001);
if (!lgt)
- goto out_free_security_data;
+ goto out_free_metadata_lte;
metadata_lte->resource_entry.flags = WIM_RESHDR_FLAG_METADATA;
random_hash(metadata_lte->hash);
/* Change the current image to the new one. */
return wimlib_select_image(w, w->hdr.image_count);
-out_free_security_data:
- FREE(sd);
out_free_metadata_lte:
FREE(metadata_lte);
out_free_imd:
char *p;
char *eol;
char *next_p;
- size_t next_bytes_remaining;
size_t bytes_remaining;
enum pattern_type type = NONE;
int ret;
if (eol - p > 2 && isalpha(*p) && *(p + 1) == ':')
p += 2;
+ ret = 0;
if (strcmp(p, "[ExclusionList]") == 0)
type = EXCLUSION_LIST;
else if (strcmp(p, "[ExclusionException]") == 0)
type = COMPRESSION_EXCLUSION_LIST;
else if (strcmp(p, "[AlignmentList]") == 0)
type = ALIGNMENT_LIST;
- else switch (type) {
+ else if (p[0] == '[' && strrchr(p, ']')) {
+ ERROR("Unknown capture configuration section `%s'", p);
+ ret = WIMLIB_ERR_INVALID_CAPTURE_CONFIG;
+ goto out_destroy;
+ } else switch (type) {
case EXCLUSION_LIST:
DEBUG("Adding pattern \"%s\" to exclusion list", p);
ret = pattern_list_add_pattern(&config->exclusion_list, p);
void *extra_arg)
{
struct dentry *root_dentry = NULL;
- struct image_metadata *imd;
struct wim_security_data *sd;
struct capture_config config;
struct link_group_table *lgt;
return ret;
out_free_dentry_tree:
free_dentry_tree(root_dentry, w->lookup_table);
-out_free_sd:
free_security_data(sd);
out_destroy_config:
destroy_capture_config(&config);
wimlib_assert(dentry->resolved);
- lte = lte_decrement_refcnt(lte, lookup_table);
+ lte = lte_decrement_refcnt(ads_entry->lte, lookup_table);
if (lte)
list_del(&ads_entry->lte_group_list.list);
dentry_remove_ads(dentry, ads_entry);
lte = dentry_unnamed_lte_resolved(dentry);
if (lte) {
if (lte->resource_location == RESOURCE_IN_STAGING_FILE) {
+ wimlib_assert(mount_flags & WIMLIB_MOUNT_FLAG_READWRITE);
wimlib_assert(lte->staging_file_name);
struct stat native_stat;
if (stat(lte->staging_file_name, &native_stat) != 0) {
static struct lookup_table_entry *
lte_extract_fds(struct lookup_table_entry *old_lte, u64 link_group)
{
- int ret;
u16 num_transferred_fds;
struct lookup_table_entry *new_lte;
new_lte = old_lte;
} else {
DEBUG("Splitting lookup table entry "
- "(link_group_size = %u, lte refcnt = %u)",
+ "(link_group_size = %zu, lte refcnt = %u)",
link_group_size, old_lte->refcnt);
/* Split a hard link group away from the "lookup table
* entry" hard link group (i.e. we had two hard link
if (ret != 0)
return ret;
}
- if (ret != 0)
- return ret;
xml_update_image_info(w, w->current_image);
*/
static int wimfs_getattr(const char *path, struct stat *stbuf)
{
- const char *stream_name;
- char *p = NULL;
struct dentry *dentry;
int ret;
return res_size;
if (res_size > size)
return -ERANGE;
- ret = read_full_wim_resource(lte, value);
+ ret = read_full_wim_resource(lte, (u8*)value);
if (ret != 0)
return -EIO;
return res_size;
static int wimfs_mknod(const char *path, mode_t mode, dev_t rdev)
{
const char *stream_name;
- const char *file_name;
if ((mount_flags & WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_WINDOWS)
&& (stream_name = path_stream_name(path))) {
/* Make an alternate data stream */
{
struct dentry *dentry;
struct lookup_table_entry *lte;
- u8 *dentry_hash;
int ret;
struct wimlib_fd *fd;
unsigned stream_idx;
size = min(size, res_entry->original_size - offset);
- if (read_wim_resource(fd->lte, buf, size, offset, false) != 0)
+ if (read_wim_resource(fd->lte, (u8*)buf,
+ size, offset, false) != 0)
return -EIO;
return size;
}
/* Close a file. */
static int wimfs_release(const char *path, struct fuse_file_info *fi)
{
- int ret;
struct wimlib_fd *fd = (struct wimlib_fd*)fi->fh;
if (!fd) {
{
struct dentry *dentry;
struct ads_entry *ads_entry;
- int ret;
if (!(mount_flags & WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_XATTR))
return -ENOTSUP;
struct lookup_table_entry *existing_lte;
struct lookup_table_entry *lte;
u8 value_hash[SHA1_HASH_SIZE];
- int ret;
- int fd;
if (!(mount_flags & WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_XATTR))
return -ENOTSUP;
if (!new_ads_entry)
return -ENOMEM;
- sha1_buffer(value, size, value_hash);
+ sha1_buffer((const u8*)value, size, value_hash);
existing_lte = __lookup_resource(w->lookup_table, value_hash);
lte = existing_lte;
lte->refcnt++;
} else {
- char *value_copy;
+ u8 *value_copy;
lte = new_lookup_table_entry();
if (!lte)
return -ENOMEM;
struct dentry *dentry;
struct lookup_table_entry *lte;
int ret;
- u8 *dentry_hash;
unsigned stream_idx;
ret = lookup_resource(w, path, get_lookup_flags(), &dentry,
struct stream_list_head *head;
WARNING("The following lookup table entry has a reference count "
"of %u, but", lte->refcnt);
- WARNING("We found %u references to it", lte_group_size);
+ WARNING("We found %zu references to it", lte_group_size);
next = lte->lte_group_list.next;
head = container_of(next, struct stream_list_head, list);
if (head->type == STREAM_TYPE_NORMAL) {
ntfs_attr *na)
{
u64 bytes_remaining = wim_resource_size(lte);
- char buf[min(WIM_CHUNK_SIZE, bytes_remaining)];
+ u8 buf[min(WIM_CHUNK_SIZE, bytes_remaining)];
u64 offset = 0;
int ret = 0;
u8 hash[SHA1_HASH_SIZE];
return ret;
}
-static bool in_same_dir(const char *path1, const char *path2)
-{
- const char *p1 = strrchr(path1, '/');
- const char *p2 = strrchr(path2, '/');
- if (p1 - path1 != p2 - path2)
- return false;
- return memcmp(path1, path2, p1 - path1) == 0;
-}
-
/*
* Makes a NTFS hard link
*
*p = '\0';
dir_name = from_dentry->full_path_utf8;
- dir_ni = ntfs_pathname_to_inode(vol, NULL,
- from_dentry->full_path_utf8);
+ dir_ni = ntfs_pathname_to_inode(vol, NULL, dir_name);
if (!dir_ni) {
ERROR_WITH_ERRNO("Could not find NTFS inode for `%s'",
from_dentry->full_path_utf8);
SACL_SECURITY_INFORMATION;
if (!ntfs_inode_set_security(ni, selection,
- sd->descriptors[dentry->security_id]))
+ (const char*)sd->descriptors[dentry->security_id]))
{
ERROR_WITH_ERRNO("Failed to set security data on `%s'",
dentry->full_path_utf8);
return WIMLIB_ERR_INVALID_DENTRY;
}
- char reparse_data_buf[8 + wim_resource_size(lte)];
- char *p = reparse_data_buf;
+ u8 reparse_data_buf[8 + wim_resource_size(lte)];
+ u8 *p = reparse_data_buf;
p = put_u32(p, dentry->reparse_tag); /* ReparseTag */
p = put_u16(p, wim_resource_size(lte)); /* ReparseDataLength */
p = put_u16(p, 0); /* Reserved */
if (ret != 0)
return ret;
- ret = ntfs_set_ntfs_reparse_data(ni, reparse_data_buf,
+ ret = ntfs_set_ntfs_reparse_data(ni, (char*)reparse_data_buf,
wim_resource_size(lte) + 8, 0);
if (ret != 0) {
ERROR_WITH_ERRNO("Failed to set NTFS reparse data on `%s'",
ret = WIMLIB_ERR_NTFS_3G;
ERROR_WITH_ERRNO("Failed to close directory inode");
}
-out_close_ni:
if (ni && ntfs_inode_close(ni) != 0) {
if (ret == 0)
ret = WIMLIB_ERR_NTFS_3G;
int extract_flags = args->extract_flags;
WIMStruct *w = args->w;
ntfs_inode *dir_ni;
- int ret;
char *p;
char orig;
- ntfs_inode *close_after_dir;
const char *dir_name;
if (dentry->extracted_file)
{
struct ntfs_apply_args *args = arg;
ntfs_volume *vol = args->vol;
- int extract_flags = args->extract_flags;
- WIMStruct *w = args->w;
- char *p;
- char buf[24];
+ u8 *p;
+ u8 buf[24];
ntfs_inode *ni;
int ret = 0;
p = put_u64(p, dentry->creation_time);
p = put_u64(p, dentry->last_write_time);
p = put_u64(p, dentry->last_access_time);
- ret = ntfs_inode_set_times(ni, buf, 3 * sizeof(u64), 0);
+ ret = ntfs_inode_set_times(ni, (const char*)buf, 3 * sizeof(u64), 0);
if (ret != 0) {
ERROR_WITH_ERRNO("Failed to set NTFS timestamps on `%s'",
dentry->full_path_utf8);
* the security ID for it. If a new security descriptor cannot be allocated,
* return -1.
*/
-static int sd_set_add_sd(struct sd_set *sd_set, const u8 *descriptor,
+static int sd_set_add_sd(struct sd_set *sd_set, const char descriptor[],
size_t size)
{
u8 hash[SHA1_HASH_SIZE];
u8 *descr_copy;
struct wim_security_data *sd;
- sha1_buffer(descriptor, size, hash);
+ sha1_buffer((const u8*)descriptor, size, hash);
security_id = lookup_sd(hash, sd_set->root);
if (security_id >= 0)
return security_id;
ntfs_attr_search_ctx *actx;
u8 attr_hash[SHA1_HASH_SIZE];
- struct ntfs_location *ntfs_loc;
+ struct ntfs_location *ntfs_loc = NULL;
struct lookup_table_entry *lte;
int ret = 0;
if (lte) {
lte->refcnt++;
} else {
- struct ntfs_location *ntfs_loc;
-
ntfs_loc = CALLOC(1, sizeof(*ntfs_loc));
if (!ntfs_loc)
goto out_put_actx;
dentry->lte = lte;
} else {
struct ads_entry *new_ads_entry;
- stream_name_utf8 = utf16_to_utf8((const u8*)attr_record_name(actx->attr),
+ stream_name_utf8 = utf16_to_utf8((const char*)attr_record_name(actx->attr),
actx->attr->name_length,
&stream_name_utf16_len);
if (!stream_name_utf8)
ret = -1;
- utf8_name = utf16_to_utf8((const u8*)name, name_len * 2,
+ utf8_name = utf16_to_utf8((const char*)name, name_len * 2,
&utf8_name_len);
if (!utf8_name)
goto out;
child->file_name_utf8, ctx->parent->file_name_utf8);
link_dentry(child, ctx->parent);
}
-out_close_ni:
ntfs_inode_close(ni);
out_free_utf8_name:
FREE(utf8_name);
DACL_SECURITY_INFORMATION |
SACL_SECURITY_INFORMATION,
NULL, 0, &sd_size);
- u8 sd[sd_size];
+ char sd[sd_size];
ret = ntfs_inode_get_security(ni,
OWNER_SECURITY_INFORMATION |
GROUP_SECURITY_INFORMATION |
unsigned *compressed_chunk_len_ret,
int ctype)
{
- unsigned compressed_chunk_sz;
int (*compress)(const void *, unsigned, void *, unsigned *);
switch (ctype) {
case WIM_COMPRESSION_TYPE_LZX:
} else {
u8 *compressed_chunk = alloca(chunk_size);
int ret;
- unsigned compressed_chunk_len;
ret = compress_chunk(chunk, chunk_size, compressed_chunk,
&out_chunk_size, out_ctype);
{
size_t bytes_written;
if (fseeko(out_fp, chunk_tab->file_offset, SEEK_SET) != 0) {
- ERROR_WITH_ERRNO("Failed to seek to byte "PRIu64" of output "
+ ERROR_WITH_ERRNO("Failed to seek to byte %"PRIu64" of output "
"WIM file", chunk_tab->file_offset);
return WIMLIB_ERR_WRITE;
}
return 0;
/* Buffer for reading chunks for the resource */
- char buf[min(WIM_CHUNK_SIZE, bytes_remaining)];
+ u8 buf[min(WIM_CHUNK_SIZE, bytes_remaining)];
/* If we are writing a compressed resource and not doing a raw copy, we
* need to initialize the chunk table */
/* Oops! We compressed the resource to larger than the original
* size. Write the resource uncompressed instead. */
if (fseeko(out_fp, file_offset, SEEK_SET) != 0) {
- ERROR_WITH_ERRNO("Failed to seek to byte "PRIu64" "
+ ERROR_WITH_ERRNO("Failed to seek to byte %"PRIu64" "
"of output WIM file", file_offset);
ret = WIMLIB_ERR_WRITE;
goto out_fclose;
u64 size)
{
u64 bytes_remaining = size;
- char buf[min(WIM_CHUNK_SIZE, bytes_remaining)];
+ u8 buf[min(WIM_CHUNK_SIZE, bytes_remaining)];
u64 offset = 0;
int ret = 0;
u8 hash[SHA1_HASH_SIZE];
int read_metadata_resource(WIMStruct *w, struct image_metadata *imd)
{
u8 *buf;
- int ctype;
u32 dentry_offset;
int ret;
struct dentry *dentry;
* no security descriptors) and WIM_DENTRY_DISK_SIZE is for the root
* dentry. */
if (metadata_len < 8 + WIM_DENTRY_DISK_SIZE) {
- ERROR("Expected at least %zu bytes for the metadata resource",
+ ERROR("Expected at least %u bytes for the metadata resource",
8 + WIM_DENTRY_DISK_SIZE);
return WIMLIB_ERR_INVALID_RESOURCE_SIZE;
}
int ret;
u64 subdir_offset;
struct dentry *root;
- struct lookup_table_entry *lte, *duplicate_lte;
+ struct lookup_table_entry *lte;
u64 metadata_original_size;
const struct wim_security_data *sd;
const unsigned random_tail_len = 20;
p = metadata_resource;
p = get_u32(p, &sd->total_length);
- p = get_u32(p, &sd->num_entries);
+ p = get_u32(p, (u32*)&sd->num_entries);
if (sd->num_entries > 0x7fffffff) {
ERROR("Security data has too many entries!");
return true;
}
-static void zero_hash(u8 hash[SHA1_HASH_SIZE])
+static inline void zero_hash(u8 hash[SHA1_HASH_SIZE])
{
memset(hash, 0, SHA1_HASH_SIZE);
}
}
if (header_size + substitute_name_offset + substitute_name_len > resource_len)
return -EIO;
- link_target = utf16_to_utf8(p + substitute_name_offset,
+ link_target = utf16_to_utf8((const char *)p + substitute_name_offset,
substitute_name_len,
&link_target_len);
for (size_t i = 0; i < utf16_len / 2; i++)
if (((u16*)name_utf16)[i] == to_le16('/'))
((u16*)name_utf16)[i] = to_le16('\\');
- size_t len = 12 + utf16_len * 2;
+ size_t len = 12 + utf16_len * 2 + 4;
void *buf = MALLOC(len);
if (!buf)
goto out;
/* XXX Fix absolute paths */
u8 *p = buf;
- p = put_u16(p, utf16_len); /* Substitute name offset */
+ p = put_u16(p, utf16_len + 2); /* Substitute name offset */
p = put_u16(p, utf16_len); /* Substitute name length */
p = put_u16(p, 0); /* Print name offset */
p = put_u16(p, utf16_len); /* Print name length */
p = put_u32(p, 1);
- p = put_bytes(p, utf16_len, name_utf16);
- p = put_bytes(p, utf16_len, name_utf16);
+ p = put_bytes(p, utf16_len, (const u8*)name_utf16);
+ p = put_u16(p, 0);
+ p = put_bytes(p, utf16_len, (const u8*)name_utf16);
+ p = put_u16(p, 0);
/*DEBUG("utf16_len = %zu, len = %zu", utf16_len, len);*/
*len_ret = len;
out:
if (wim_resource_size(lte) > 10000)
return -EIO;
- char res_buf[wim_resource_size(lte)];
+ u8 res_buf[wim_resource_size(lte)];
ret = read_full_wim_resource(lte, res_buf);
if (ret != 0)
return -EIO;
static int clone_image_info(const struct image_info *old, struct image_info *new)
{
- int ret;
-
new->dir_count = old->dir_count;
new->file_count = old->file_count;
new->total_bytes = old->total_bytes;
struct wim_info *new_wim_info;
struct image_info *image_info;
int ret;
- char *name;
- char *desc;
DEBUG("Copying XML data between WIM files for source image %d.", image);
rm -rf dir* tmp* *.wim *.swm
}
trap cleanup exit
+fusermount -u tmp || true
+rm -rf tmp || true
# Make test directory
mkdir dir