X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Funix_apply.c;h=86be081ff006cf220ec2850512c8f032deddc00d;hb=61ac5994e9fe3666d1c057dafca8c79406c59077;hp=bd576ef08c0f872f04ceb77b940bde72fa67b64a;hpb=38224a9fd97ee047951bb8ab99a089d5c67aebe5;p=wimlib diff --git a/src/unix_apply.c b/src/unix_apply.c index bd576ef0..86be081f 100644 --- a/src/unix_apply.c +++ b/src/unix_apply.c @@ -54,7 +54,7 @@ unix_start_extract(const char *target, struct apply_ctx *ctx) } static int -unix_create_file(const char *path, struct apply_ctx *ctx) +unix_create_file(const char *path, struct apply_ctx *ctx, u64 *cookie_ret) { int fd = open(path, O_TRUNC | O_CREAT | O_WRONLY, 0644); if (fd < 0) @@ -64,7 +64,7 @@ unix_create_file(const char *path, struct apply_ctx *ctx) } static int -unix_create_directory(const tchar *path, struct apply_ctx *ctx) +unix_create_directory(const tchar *path, struct apply_ctx *ctx, u64 *cookie_ret) { struct stat stbuf; @@ -72,10 +72,10 @@ unix_create_directory(const tchar *path, struct apply_ctx *ctx) if (errno != EEXIST) return WIMLIB_ERR_MKDIR; if (lstat(path, &stbuf)) - return WIMLIB_ERR_STAT; + return WIMLIB_ERR_MKDIR; errno = EEXIST; if (!S_ISDIR(stbuf.st_mode)) - return WIMLIB_ERR_NOTDIR; + return WIMLIB_ERR_MKDIR; } return 0; } @@ -85,14 +85,12 @@ unix_makelink(const tchar *oldpath, const tchar *newpath, int (*makelink)(const tchar *oldpath, const tchar *newpath)) { if ((*makelink)(oldpath, newpath)) { - if (errno == EEXIST) { - if (unlink(newpath)) - return WIMLIB_ERR_LINK; - if ((*makelink)(oldpath, newpath)) - return WIMLIB_ERR_LINK; - return 0; - } - return WIMLIB_ERR_LINK; + if (errno != EEXIST) + return WIMLIB_ERR_LINK; + if (unlink(newpath)) + return WIMLIB_ERR_LINK; + if ((*makelink)(oldpath, newpath)) + return WIMLIB_ERR_LINK; } return 0; } @@ -111,10 +109,11 @@ unix_create_symlink(const tchar *oldpath, const tchar *newpath, } static int -unix_extract_unnamed_stream(const tchar *path, +unix_extract_unnamed_stream(file_spec_t file, struct wim_lookup_table_entry *lte, struct apply_ctx *ctx) { + const char *path = file.path; struct filedes fd; int raw_fd; int ret;