Building wimlib using Cygwin is not supported. I was trying this for a while,
but I ran into some issues with mixing native Win32 functions and
-Cygwin-provided functions, so I just made it possible to do a native Win32 build
+Cygwin-provided functions, so I made it possible to do a native Win32 build
instead.
int errno_save = errno;
struct iconv_node *i = container_of(cd, struct iconv_node, cd);
struct iconv_list_head *head = i->head;
-
+
pthread_mutex_lock(&head->mutex);
list_add(&i->list, &head->list);
pthread_mutex_unlock(&head->mutex);
pthread_mutex_destroy(&head->mutex);
while (!list_empty(&head->list)) {
struct iconv_node *i;
-
+
i = container_of(head->list.next, struct iconv_node, list);
list_del(&i->list);
iconv_close(i->cd);
}
}
-static void
+static void
destroy_dos_name_map(struct dos_name_map *map)
{
free_dos_name_tree(map->rb_root.rb_node);
/* Return now if an error occurred or if this is just a DOS name
* and not a Win32+DOS name. */
if (ret != 0 || name_type == FILE_NAME_DOS)
- return ret;
+ goto out;
}
ret = utf16le_to_mbs(name, name_nbytes,
&mbs_name, &mbs_name_nbytes);
- if (ret != 0)
- return -1;
+ if (ret)
+ goto out;
if (mbs_name[0] == '.' &&
(mbs_name[1] == '\0' ||
ntfs_inode *ni = ntfs_inode_open(ctx->dir_ni->vol, mref);
if (!ni) {
ERROR_WITH_ERRNO("Failed to open NTFS inode");
+ ret = -1;
goto out_free_mbs_name;
}
path_len = ctx->path_len;
ntfs_inode_close(ni);
out_free_mbs_name:
FREE(mbs_name);
+out:
return ret;
}
static void
empty_sacl_fixup(u8 *descr, u64 *size_p)
{
+ /* No-op if no NTFS-3g support, or if NTFS-3g is version 2013 or later
+ * */
+#if defined(WITH_NTFS_3G) && !defined(HAVE_NTFS_MNT_RDONLY)
if (*size_p >= sizeof(SecurityDescriptor)) {
SecurityDescriptor *sd = (SecurityDescriptor*)descr;
u32 sacl_offset = le32_to_cpu(sd->sacl_offset);
*size_p -= sizeof(ACL);
}
}
+#endif
}
/*
#include <errno.h>
+static const char *access_denied_msg =
+" If you are not running this program as the administrator, you may\n"
+" need to do so, so that all data and metadata can be backed up.\n"
+" Otherwise, there may be no way to access the desired data or\n"
+" metadata without taking ownership of the file or directory.\n";
+
#ifdef ENABLE_ERROR_MESSAGES
void
win32_error(u32 err_code)
err = GetLastError();
}
}
- ERROR("Win32 API: Failed to read security descriptor of \"%ls\"",
- path_utf16);
- win32_error(err);
- return WIMLIB_ERR_READ;
+
+ if (err == ERROR_ACCESS_DENIED) {
+ WARNING("Failed to read security descriptor of \"%ls\": "
+ "Access denied!\n%s", path_utf16, access_denied_msg);
+ return 0;
+ } else {
+ ERROR("Win32 API: Failed to read security descriptor of \"%ls\"",
+ path_utf16);
+ win32_error(err);
+ return WIMLIB_ERR_READ;
+ }
}
/* Reads the directory entries of directory using a Win32 API and recursively
{
return 0;
} else {
- ERROR("Win32 API: Failed to look up data streams of \"%ls\"",
- path_utf16);
- win32_error(err);
- return WIMLIB_ERR_READ;
+ if (err == ERROR_ACCESS_DENIED) {
+ WARNING("Failed to look up data streams of \"%ls\": "
+ "Access denied!\n%s", path_utf16,
+ access_denied_msg);
+ return 0;
+ } else {
+ ERROR("Win32 API: Failed to look up data streams of \"%ls\"",
+ path_utf16);
+ win32_error(err);
+ return WIMLIB_ERR_READ;
+ }
}
}
do {
/* Undo prepare_resource_for_read() by closing the cached FILE * or NTFS
* attribute. */
-static void
+static void
end_wim_resource_read(struct wim_lookup_table_entry *lte
#ifdef WITH_NTFS_3G
, ntfs_inode *ni
return ret;
}
-/* Prints the information contained in a `struct windows_info'.
+/* Prints the information contained in a `struct windows_info'.
*
* Warning: any strings printed here are in UTF-8 encoding. If the locale
* character encoding is not UTF-8, the printed strings may be garbled. */