X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Funix_apply.c;h=152361b01432c01bf5f7fe5865182540bf7e6a5b;hb=cbd31ea4e13a4e7479b2a19dc59efd9f2dd86e5e;hp=026042bce7219fe1baecfcf5d726b7d40790d73f;hpb=962cca1a6f9e45827006a745be086b7af3b725aa;p=wimlib diff --git a/src/unix_apply.c b/src/unix_apply.c index 026042bc..152361b0 100644 --- a/src/unix_apply.c +++ b/src/unix_apply.c @@ -72,10 +72,10 @@ unix_create_directory(const tchar *path, struct apply_ctx *ctx, u64 *cookie_ret) 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; } @@ -124,7 +122,7 @@ unix_extract_unnamed_stream(file_spec_t file, if (raw_fd < 0) return WIMLIB_ERR_OPEN; filedes_init(&fd, raw_fd); - ret = extract_wim_resource_to_fd(lte, &fd, wim_resource_size(lte)); + ret = extract_stream_to_fd(lte, &fd, lte->size); if (filedes_close(&fd) && !ret) ret = WIMLIB_ERR_WRITE; return ret;