Close a file descriptor leak when cp --preserve=context fails.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 29 Nov 2007 07:32:54 +0000 (08:32 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 29 Nov 2007 07:32:54 +0000 (08:32 +0100)
* src/copy.c (copy_reg): Close dest_desc too, if getfscreatecon
or fsetfilecon fail.

ChangeLog
src/copy.c

index 7326a40785f03e7770c595ab279b97f9475efe74..38401db1dc042826eb3dff261f30fb954beb109b 100644 (file)
--- 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.
index 4dec5166e12429718e1a03259bb21e1552550e33..975890750d1d76058d55c39ab8662963b6d4e3ce 100644 (file)
@@ -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);