# include "timestamp.h"
#endif
+#ifdef __WIN32__
+#include <shlwapi.h>
+#endif
+
#include "wimlib_internal.h"
#include "dentry.h"
#include "lookup_table.h"
#include "xml.h"
#include <ctype.h>
#include <errno.h>
+
+#ifndef __WIN32__
#include <fnmatch.h>
+#endif
+
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
DWORD len = lenNeeded;
char buf[len];
if (GetFileSecurityW(path_utf16, requestedInformation,
- buf, len, &lenNeeded))
+ (PSECURITY_DESCRIPTOR)buf, len, &lenNeeded))
{
int security_id = sd_set_add_sd(sd_set, buf, len);
if (security_id < 0)
inode->i_last_write_time = unix_timestamp_to_wim(root_stbuf.st_mtime);
inode->i_last_access_time = unix_timestamp_to_wim(root_stbuf.st_atime);
#endif
- if (sizeof(ino_t) >= 8)
- inode->i_ino = (u64)root_stbuf.st_ino;
- else
- inode->i_ino = (u64)root_stbuf.st_ino |
- ((u64)root_stbuf.st_dev << ((sizeof(ino_t) * 8) & 63));
+ /* Leave the inode number at 0 for directories. */
+ if (!S_ISDIR(root_stbuf.st_mode)) {
+ if (sizeof(ino_t) >= 8)
+ inode->i_ino = (u64)root_stbuf.st_ino;
+ else
+ inode->i_ino = (u64)root_stbuf.st_ino |
+ ((u64)root_stbuf.st_dev <<
+ ((sizeof(ino_t) * 8) & 63));
+ }
inode->i_resolved = 1;
if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) {
ret = inode_set_unix_data(inode, root_stbuf.st_uid,
return 0;
}
+static bool path_matches_pattern(const char *path, const char *pattern)
+{
+#ifdef __WIN32__
+ return PathMatchSpecA(path, pattern);
+#else
+ return fnmatch(pattern, path, FNM_PATHNAME
+ #ifdef FNM_CASEFOLD
+ | FNM_CASEFOLD
+ #endif
+ ) == 0;
+#endif
+}
+
static bool match_pattern(const char *path, const char *path_basename,
const struct pattern_list *list)
{
/* A file name pattern */
string = path_basename;
}
- if (fnmatch(pat, string, FNM_PATHNAME
- #ifdef FNM_CASEFOLD
- | FNM_CASEFOLD
- #endif
- ) == 0)
- {
+
+ if (path_matches_pattern(string, pat)) {
DEBUG("`%s' matches the pattern \"%s\"",
string, pat);
return true;
DEBUG("Creating filler directory \"%s\"", name);
dentry = new_dentry_with_inode(name);
if (dentry) {
- /* Set the inode number to 0 for now. The final inode number
+ /* Leave the inode number as 0 for now. The final inode number
* will be assigned later by assign_inode_numbers(). */
- dentry->d_inode->i_ino = 0;
dentry->d_inode->i_resolved = 1;
dentry->d_inode->i_attributes = FILE_ATTRIBUTE_DIRECTORY;
}
{
struct rb_root *rb_root;
+ DEBUG("Doing overlay %s => %s",
+ branch->file_name_utf8, target->file_name_utf8);
+
if (!dentry_is_directory(target)) {
ERROR("Cannot overlay directory `%s' over non-directory",
branch->file_name_utf8);
return WIMLIB_ERR_INVALID_OVERLAY;
}
}
+ free_dentry(branch);
return 0;
}
char *slash;
struct wim_dentry *dentry, *parent, *target;
+ DEBUG("Attaching branch \"%s\" => \"%s\"",
+ branch->file_name_utf8, target_path);
+
if (*target_path == '\0') {
/* Target: root directory */
if (*root_p) {