X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Funix_apply.c;h=d1888446b452626ab2b42f50da65346d0bd3a78d;hb=f02f8a0274377459bf90d5a70cb7b72480a3df60;hp=ca0f485c4177582957a81e9e7ede0acd6b60bff9;hpb=f24f8409b041727329e980fdc81e84a7c9b00e5b;p=wimlib diff --git a/src/unix_apply.c b/src/unix_apply.c index ca0f485c..d1888446 100644 --- a/src/unix_apply.c +++ b/src/unix_apply.c @@ -29,9 +29,9 @@ #include "wimlib/apply.h" #include "wimlib/error.h" -#include "wimlib/lookup_table.h" #include "wimlib/resource.h" #include "wimlib/timestamp.h" +#include "wimlib/unix_data.h" #include #include @@ -44,6 +44,10 @@ # include #endif +#ifndef O_NOFOLLOW +# define O_NOFOLLOW 0 +#endif + static int unix_start_extract(const char *target, struct apply_ctx *ctx) { @@ -56,7 +60,7 @@ unix_start_extract(const char *target, struct apply_ctx *ctx) static int unix_create_file(const char *path, struct apply_ctx *ctx, u64 *cookie_ret) { - int fd = open(path, O_TRUNC | O_CREAT | O_WRONLY, 0644); + int fd = open(path, O_TRUNC | O_CREAT | O_WRONLY | O_NOFOLLOW, 0644); if (fd < 0) return WIMLIB_ERR_OPEN; close(fd); @@ -111,18 +115,18 @@ unix_create_symlink(const tchar *oldpath, const tchar *newpath, static int unix_extract_unnamed_stream(file_spec_t file, struct wim_lookup_table_entry *lte, - struct apply_ctx *ctx) + struct apply_ctx *ctx, struct wim_dentry *_ignore) { const char *path = file.path; struct filedes fd; int raw_fd; int ret; - raw_fd = open(path, O_WRONLY | O_TRUNC); + raw_fd = open(path, O_WRONLY | O_TRUNC | O_NOFOLLOW); if (raw_fd < 0) return WIMLIB_ERR_OPEN; filedes_init(&fd, raw_fd); - ret = extract_wim_resource_to_fd(lte, &fd, lte->size); + ret = extract_full_stream_to_fd(lte, &fd); if (filedes_close(&fd) && !ret) ret = WIMLIB_ERR_WRITE; return ret;