From 67916194fb9d9b1ace637cce8182bbb6f06b55f1 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Apr 26 2006 11:02:25 +0000 Subject: - Fix 'cp -Z' when the destination exists (bug #189967). --- diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch index 5f35570..6b49d8a 100644 --- a/coreutils-selinux.patch +++ b/coreutils-selinux.patch @@ -2245,8 +2245,8 @@ + } +#endif } ---- coreutils-5.94/src/copy.c.selinux 2006-03-24 13:23:39.000000000 +0000 -+++ coreutils-5.94/src/copy.c 2006-03-24 13:23:45.000000000 +0000 +--- coreutils-5.94/src/copy.c 2006-03-24 13:23:45.000000000 +0000 ++++ coreutils-5.94/src/copy.c 2006-04-26 14:06:02.000000000 +1000 @@ -51,6 +51,11 @@ #include "xreadlink.h" #include "yesno.h" @@ -2259,7 +2259,33 @@ #ifndef HAVE_FCHMOD # define HAVE_FCHMOD false #endif -@@ -1416,6 +1421,32 @@ +@@ -238,6 +243,25 @@ + { + dest_desc = open (dst_name, O_WRONLY | O_TRUNC | O_BINARY, dst_mode); + ++#ifdef WITH_SELINUX ++ if (dest_desc >= 0) ++ { ++ security_context_t con; ++ if(getfscreatecon(&con) == -1) ++ { ++ return_val = false; ++ goto close_src_desc; ++ } ++ if(fsetfilecon(dest_desc, con) == -1) ++ { ++ return_val = false; ++ freecon(con); ++ goto close_src_desc; ++ } ++ freecon(con); ++ } ++#endif ++ + if (dest_desc < 0 && x->unlink_dest_after_failed_open) + { + if (unlink (dst_name) != 0) +@@ -1416,6 +1440,32 @@ In such cases, set this variable to zero. */ preserve_metadata = true; @@ -2292,7 +2318,7 @@ if (S_ISDIR (src_mode)) { struct dir_list *dir; -@@ -1486,7 +1517,13 @@ +@@ -1486,7 +1536,13 @@ /* Are we crossing a file system boundary? */ if (x->one_file_system && device != 0 && device != src_sb.st_dev) @@ -2307,7 +2333,7 @@ /* Copy the contents of the directory. */ -@@ -1622,6 +1659,11 @@ +@@ -1622,6 +1678,11 @@ } } @@ -2319,7 +2345,7 @@ /* There's no need to preserve timestamps or permissions. */ preserve_metadata = false; -@@ -1760,6 +1802,11 @@ +@@ -1760,6 +1821,11 @@ un_backup: diff --git a/coreutils.spec b/coreutils.spec index 9013659..9531058 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: The GNU core utilities: a set of tools commonly used in shell scripts Name: coreutils Version: 5.94 -Release: 3 +Release: 4 License: GPL Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -261,6 +261,9 @@ fi /sbin/runuser %changelog +* Wed Apr 26 2006 Tim Waugh 5.94-4 +- Fix 'cp -Z' when the destination exists (bug #189967). + * Thu Apr 20 2006 Tim Waugh 5.94-3 - Make 'ls -Z' output more consistent with other output formats.