From f548a3a6006fb95dfd71b6137fdd5c9c3fa52608 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 14 Oct 2004 18:23:21 +0000 Subject: [PATCH] make it add attribute if it's not present (Logical change 1.612) --- ntfsprogs/ntfscp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index b12b9ad2..d1329c8c 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -312,8 +312,18 @@ int main (int argc, char *argv[]) } na = ntfs_attr_open(out, opts.attribute, attr_name, attr_name_len); if (!na) { - perror("ERROR: Couldn't open attribute"); - goto close_dst; + if (errno != ENOENT) { + perror("ERROR: Couldn't open attribute"); + goto close_dst; + } + /* Requested attribute isn't present, add it. */ + na = ntfs_inode_add_attr(out, opts.attribute, attr_name, + attr_name_len, 0); + if (!na) { + perror("ERROR: Couldn't add attribute"); + goto close_dst; + } + need_logfile_reset = 1; } Vprintf("Old file size: %lld\n", na->data_size);