X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fadd_image.c;h=61ed013225ef696fc009228c2964eea3b2ea5d07;hp=62fbdfb3141bc2647696117fcb26ada96efb4a69;hb=1d8b904a7424f6e38bcba0b2c3a3078f43781029;hpb=01919fdd57105c0ab91316b79c10e3992e686436 diff --git a/src/add_image.c b/src/add_image.c index 62fbdfb3..61ed0132 100644 --- a/src/add_image.c +++ b/src/add_image.c @@ -230,10 +230,17 @@ static int build_dentry_tree(struct wim_dentry **root_ret, else inode->i_ino = (u64)root_stbuf.st_ino | ((u64)root_stbuf.st_dev << ((sizeof(ino_t) * 8) & 63)); - - add_image_flags &= ~WIMLIB_ADD_IMAGE_FLAG_ROOT; inode->i_resolved = 1; - + if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) { + ret = inode_set_unix_data(inode, root_stbuf.st_uid, + root_stbuf.st_gid, + root_stbuf.st_mode, + lookup_table, + UNIX_DATA_ALL | UNIX_DATA_CREATE); + if (ret) + goto out; + } + add_image_flags &= ~WIMLIB_ADD_IMAGE_FLAG_ROOT; if (S_ISREG(root_stbuf.st_mode)) { /* Archiving a regular file */ struct wim_lookup_table_entry *lte; @@ -389,8 +396,13 @@ enum pattern_type { ALIGNMENT_LIST, }; +#define COMPAT_DEFAULT_CONFIG + /* Default capture configuration file when none is specified. */ static const char *default_config = +#ifdef COMPAT_DEFAULT_CONFIG /* XXX: This policy is being moved to library + users. The next ABI-incompatible library + version will default to the empty string here. */ "[ExclusionList]\n" "\\$ntfs.log\n" "\\hiberfil.sys\n" @@ -404,6 +416,9 @@ static const char *default_config = "*.zip\n" "*.cab\n" "\\WINDOWS\\inf\\*.pnf\n"; +#else +""; +#endif static void destroy_pattern_list(struct pattern_list *list) { @@ -576,21 +591,6 @@ static bool match_pattern(const char *path, const char *path_basename, return false; } -static void print_pattern_list(const struct pattern_list *list) -{ - for (size_t i = 0; i < list->num_pats; i++) - printf(" %s\n", list->pats[i]); -} - -static void print_capture_config(const struct capture_config *config) -{ - if (config->exclusion_list.num_pats) { - puts("Files or folders excluded from image capture:"); - print_pattern_list(&config->exclusion_list); - putchar('\n'); - } -} - /* Return true if the image capture configuration file indicates we should * exclude the filename @path from capture. * @@ -635,10 +635,15 @@ WIMLIBAPI int wimlib_add_image(WIMStruct *w, const char *source, if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_NTFS) { #ifdef WITH_NTFS_3G - if (add_image_flags & (WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE)) { + if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE) { ERROR("Cannot dereference files when capturing directly from NTFS"); return WIMLIB_ERR_INVALID_PARAM; } + if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) { + ERROR("Capturing UNIX owner and mode not supported " + "when capturing directly from NTFS"); + return WIMLIB_ERR_INVALID_PARAM; + } capture_tree = build_dentry_tree_ntfs; extra_arg = &w->ntfs_vol; #else @@ -682,7 +687,6 @@ WIMLIBAPI int wimlib_add_image(WIMStruct *w, const char *source, ret = init_capture_config(config_str, config_len, source, &config); if (ret != 0) return ret; - print_capture_config(&config); DEBUG("Allocating security data");