summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-11-29 08:32:54 +0100
committerJim Meyering <meyering@redhat.com>2007-11-29 08:32:54 +0100
commit9962f24cc458e7d7588d4d043339823067aa3b83 (patch)
tree5ee8e507d0bda051d1e92640b7b1f386f58f5e1d
parent4352534a0cb9f48fc47f98e048265087a6cd9dba (diff)
downloadcoreutils-9962f24cc458e7d7588d4d043339823067aa3b83.tar.xz
Close a file descriptor leak when cp --preserve=context fails.
* src/copy.c (copy_reg): Close dest_desc too, if getfscreatecon or fsetfilecon fail.
-rw-r--r--ChangeLog6
-rw-r--r--src/copy.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7326a4078..38401db1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-28 Paul Eggert <eggert@cs.ucla.edu>
+
+ Close a file descriptor leak when cp --preserve=context fails.
+ * src/copy.c (copy_reg): Close dest_desc too, if getfscreatecon
+ or fsetfilecon fail.
+
2007-11-28 Jim Meyering <meyering@redhat.com>
* README: Document the known problem with gettext <= 0.17.
diff --git a/src/copy.c b/src/copy.c
index 4dec5166e..975890750 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -341,7 +341,7 @@ copy_reg (char const *src_name, char const *dst_name,
if (x->require_preserve_context)
{
return_val = false;
- goto close_src_desc;
+ goto close_src_and_dst_desc;
}
}
@@ -356,7 +356,7 @@ copy_reg (char const *src_name, char const *dst_name,
{
return_val = false;
freecon (con);
- goto close_src_desc;
+ goto close_src_and_dst_desc;
}
}
freecon(con);