From 1a94ac4a0524a760c1c3ea7a5ca9032e994785c2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Wed, 2 Sep 2009 10:34:27 +0100 Subject: [PATCH] cp: don't leak resources for each xattr preservation failure * src/copy.c (copy_reg): Don't return from the function after an unsuccessful and required preservation of extended attributes. This resulted in leaking the copy buffer and file descriptors. * NEWS (Bug fixes): Mention the fix. The bug was introduced in coreutils-7.1 via commit 0889381c, 2009-01-23, "cp/mv: add xattr support". --- NEWS | 3 +++ src/copy.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 50c40be..59270eb 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ GNU coreutils NEWS -*- outline -*- cp --reflink --preserve now preserves attributes when cloning a file. [bug introduced in coreutils-7.5] + cp --preserve=xattr no longer leaks resources on each preservation failure. + [bug introduced in coreutils-7.1] + dd now returns non-zero status if it encountered a write error while printing a summary to stderr. [bug introduced in coreutils-6.11] diff --git a/src/copy.c b/src/copy.c index d1e508d..e604ec5 100644 --- a/src/copy.c +++ b/src/copy.c @@ -853,7 +853,7 @@ copy_reg (char const *src_name, char const *dst_name, if (x->preserve_xattr && ! copy_attr_by_fd (src_name, source_desc, dst_name, dest_desc, x) && x->require_preserve_xattr) - return false; + return_val = false; if (x->preserve_mode || x->move_mode) { -- 2.7.4