X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fextract.c;h=769abbe15235551b9d93a4f5647d0b66b133024d;hp=39da4bee378b1afedd0c8ab34f56c69ed45bc260;hb=5ea71b35aff264dea029792b1fdb3404c6bd9d54;hpb=81d03c562d98c865fb2c03978231c250f68cb0a7 diff --git a/src/extract.c b/src/extract.c index 39da4bee..769abbe1 100644 --- a/src/extract.c +++ b/src/extract.c @@ -28,7 +28,7 @@ * wimlib_extract_pathlist(). Internally, all end up calling * do_wimlib_extract_paths() and extract_trees(). * - * Although wimlib supports multiple extraction modes/backends (NTFS-3g, UNIX, + * Although wimlib supports multiple extraction modes/backends (NTFS-3G, UNIX, * Win32), this file does not itself have code to extract files or directories * to any specific target; instead, it handles generic functionality and relies * on lower-level callback functions declared in `struct apply_operations' to do @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -52,6 +53,7 @@ #include "wimlib/endianness.h" #include "wimlib/error.h" #include "wimlib/metadata.h" +#include "wimlib/object_id.h" #include "wimlib/pathlist.h" #include "wimlib/paths.h" #include "wimlib/pattern.h" @@ -315,27 +317,33 @@ static int create_temporary_file(struct filedes *fd_ret, tchar **name_ret) { tchar *name; - int open_flags; int raw_fd; +#ifdef __WIN32__ retry: - name = ttempnam(NULL, T("wimlib")); + name = _wtempnam(NULL, L"wimlib"); if (!name) { ERROR_WITH_ERRNO("Failed to create temporary filename"); return WIMLIB_ERR_NOMEM; } - - open_flags = O_WRONLY | O_CREAT | O_EXCL | O_BINARY; -#ifdef __WIN32__ - open_flags |= _O_SHORT_LIVED; -#endif - raw_fd = topen(name, open_flags, 0600); + raw_fd = _wopen(name, O_WRONLY | O_CREAT | O_EXCL | O_BINARY | + _O_SHORT_LIVED, 0600); + if (raw_fd < 0 && errno == EEXIST) { + FREE(name); + goto retry; + } +#else /* __WIN32__ */ + const char *tmpdir = getenv("TMPDIR"); + if (!tmpdir) + tmpdir = P_tmpdir; + name = MALLOC(strlen(tmpdir) + 1 + 6 + 6 + 1); + if (!name) + return WIMLIB_ERR_NOMEM; + sprintf(name, "%s/wimlibXXXXXX", tmpdir); + raw_fd = mkstemp(name); +#endif /* !__WIN32__ */ if (raw_fd < 0) { - if (errno == EEXIST) { - FREE(name); - goto retry; - } ERROR_WITH_ERRNO("Failed to create temporary file " "\"%"TS"\"", name); FREE(name); @@ -1155,6 +1163,8 @@ inode_tally_features(const struct wim_inode *inode, features->security_descriptors++; if (inode_has_unix_data(inode)) features->unix_data++; + if (inode_has_object_id(inode)) + features->object_ids++; } /* Tally features necessary to extract a dentry and the corresponding inode. */ @@ -1307,6 +1317,12 @@ do_feature_check(const struct wim_features *required_features, required_features->unix_data); } + /* Object IDs. */ + if (required_features->object_ids && !supported_features->object_ids) { + WARNING("Ignoring object IDs of %lu files", + required_features->object_ids); + } + /* DOS Names. */ if (required_features->short_names && !supported_features->short_names) @@ -1526,7 +1542,7 @@ check_extract_flags(const WIMStruct *wim, int *extract_flags_p) #ifndef WITH_NTFS_3G if (extract_flags & WIMLIB_EXTRACT_FLAG_NTFS) { - ERROR("wimlib was compiled without support for NTFS-3g, so\n" + ERROR("wimlib was compiled without support for NTFS-3G, so\n" " it cannot apply a WIM image directly to an NTFS volume."); return WIMLIB_ERR_UNSUPPORTED; }