#endif
#include "wimlib/apply.h"
+#include "wimlib/assert.h"
#include "wimlib/dentry.h"
#include "wimlib/error.h"
#include "wimlib/file_io.h"
}
#define NUM_PATHBUFS 2 /* We need 2 when creating hard links */
-#define MAX_OPEN_FDS 1024 /* TODO: Add special case for when the number of
- identical streams exceeds this number. */
struct unix_apply_ctx {
/* Extract flags, the pointer to the WIMStruct, etc. */
unsigned which_pathbuf;
/* Currently open file descriptors for extraction */
- struct filedes open_fds[MAX_OPEN_FDS];
+ struct filedes open_fds[MAX_OPEN_STREAMS];
/* Number of currently open file descriptors in open_fds, starting from
* the beginning of the array. */
return 0;
}
+ /* This should be ensured by extract_stream_list() */
+ wimlib_assert(ctx->num_open_fds < MAX_OPEN_STREAMS);
+
first_dentry = inode_first_extraction_dentry(inode);
first_path = unix_build_extraction_path(first_dentry, ctx);
retry_create:
/* Called when starting to read a single-instance stream for extraction */
static int
-unix_begin_extract_stream(struct wim_lookup_table_entry *stream,
- u32 flags, void *_ctx)
+unix_begin_extract_stream(struct wim_lookup_table_entry *stream, void *_ctx)
{
struct unix_apply_ctx *ctx = _ctx;
const struct stream_owner *owners = stream_owners(stream);
/* We finally have the symlink data, so we can create
* the symlink. */
const char *path;
+ bool rpfix;
+
+ rpfix = (ctx->common.extract_flags &
+ WIMLIB_EXTRACT_FLAG_RPFIX) &&
+ !inode->i_not_rpfixed;
path = unix_build_inode_extraction_path(inode, ctx);
ret = unix_create_symlink(inode, path,
ctx->reparse_data,
stream->size,
- (ctx->common.extract_flags &
- WIMLIB_EXTRACT_FLAG_RPFIX),
+ rpfix,
ctx->target_abspath,
ctx->target_abspath_nchars);
if (ret) {