#include "lookup_table.h"
#include "sha1.h"
#include <errno.h>
+#include <stdlib.h>
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#endif
static const utf16lechar volume_junction_prefix[11] = {
cpu_to_le16('\\'),
}
/* Read the data from the WIM file */
- ret = read_full_resource_into_buf(lte, rpbuf + 8, true);
+ ret = read_full_resource_into_buf(lte, rpbuf + 8);
if (ret)
return ret;
return ret;
}
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-
int
wim_inode_set_symlink(struct wim_inode *inode,
const char *target,
{
struct stat stbuf;
if (stat(path, &stbuf)) {
- WARNING_WITH_ERRNO("Failed to stat \"%s\"", path);
+ if (errno != ENOENT)
+ WARNING_WITH_ERRNO("Failed to stat \"%s\"", path);
/* Treat as a link pointing outside the capture root (it
* most likely is). */
return WIMLIB_ERR_STAT;
/* Fix up absolute symbolic link targets--- mostly shared between UNIX and
* Windows */
tchar *
-fixup_symlink(tchar *dest, u64 capture_root_ino, u64 capture_root_dev)
+capture_fixup_absolute_symlink(tchar *dest,
+ u64 capture_root_ino, u64 capture_root_dev)
{
tchar *p = dest;
+#ifdef __WIN32__
+ /* Skip drive letter */
+ if (!is_rp_path_separator(*dest))
+ p += 2;
+#endif
+
DEBUG("Fixing symlink or junction \"%"TS"\"", dest);
for (;;) {
tchar save;
*(p - 1) = RP_PATH_SEPARATOR;
while (p - 1 >= dest && is_rp_path_separator(*(p - 1)))
p--;
+ #ifdef __WIN32__
+ if (!is_rp_path_separator(dest[0])) {
+ *--p = dest[1];
+ *--p = dest[0];
+ }
+ #endif
+ wimlib_assert(p >= dest);
return p;
}