X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fmount_image.c;h=b9e900bca93ee5f2dace39df29306e97421913ab;hp=6c5ec885ceea017a4d306d6247083fbc280d71cd;hb=84eaa0aba56c9cf668ca5f3ac8225078ab7dd459;hpb=8eaff5673d8e133e72e20cf4409ab4c901831424 diff --git a/src/mount_image.c b/src/mount_image.c index 6c5ec885..b9e900bc 100644 --- a/src/mount_image.c +++ b/src/mount_image.c @@ -8,7 +8,7 @@ */ /* - * Copyright (C) 2012 Eric Biggers + * Copyright (C) 2012, 2013 Biggers * * This file is part of wimlib, a library for working with WIM files. * @@ -2115,7 +2115,6 @@ static int wimfs_setxattr(const char *path, const char *name, if (existing_ads_entry) { if (flags & XATTR_CREATE) return -EEXIST; - inode_remove_ads(inode, ads_idx, ctx->wim->lookup_table); } else { if (flags & XATTR_REPLACE) return -ENOATTR; @@ -2123,7 +2122,13 @@ static int wimfs_setxattr(const char *path, const char *name, ret = inode_add_ads_with_data(inode, name, (const u8*)value, size, ctx->wim->lookup_table); - return ret ? -ENOMEM : 0; + if (ret == 0) { + if (existing_ads_entry) + inode_remove_ads(inode, ads_idx, ctx->wim->lookup_table); + } else { + ret = -ENOMEM; + } + return ret; } #endif