Ondřej Vašík 4afb5b
diff -urNp coreutils-8.12-orig/src/copy.c coreutils-8.12/src/copy.c
Ondřej Vašík 4afb5b
--- coreutils-8.12-orig/src/copy.c	2011-08-11 16:05:15.432485738 +0200
Ondřej Vašík 4afb5b
+++ coreutils-8.12/src/copy.c	2011-08-11 16:14:28.660360607 +0200
Ondřej Vašík 4afb5b
@@ -850,7 +850,7 @@ copy_reg (char const *src_name, char con
Ondřej Vašík 4afb5b
          1) the src context may prohibit writing, and
Ondřej Vašík 4afb5b
          2) because it's more consistent to use the same context
Ondřej Vašík 4afb5b
          that is used when the destination file doesn't already exist.  */
Ondřej Vašík 4afb5b
-      if (x->preserve_security_context && 0 <= dest_desc)
Ondřej Vašík 4afb5b
+      if ((x->set_security_context || x->preserve_security_context) && 0 <= dest_desc)
Ondřej Vašík 4afb5b
         {
Ondřej Vašík 4afb5b
           bool all_errors = (!x->data_copy_required
Ondřej Vašík 4afb5b
                              || x->require_preserve_context);
Ondřej Vašík 4afb5b
diff -urNp coreutils-8.12-orig/src/cp.c coreutils-8.12/src/cp.c
Ondřej Vašík 4afb5b
--- coreutils-8.12-orig/src/cp.c	2011-08-11 16:05:15.435486976 +0200
Ondřej Vašík 4afb5b
+++ coreutils-8.12/src/cp.c	2011-08-11 16:16:56.408644526 +0200
Ondřej Vašík 4afb5b
@@ -1119,6 +1119,7 @@ main (int argc, char **argv)
Ondřej Vašík 4afb5b
             exit( 1 );
Ondřej Vašík 4afb5b
          }
Ondřej Vašík 4afb5b
          x.set_security_context = true;
Ondřej Vašík 4afb5b
+         (void) fprintf(stderr, _("Warning, -Z/--context option is deprecated and will be removed soon!\nPlease use 'install' utility instead of cp for this functionality.\n"));
Ondřej Vašík 4afb5b
          /* if there's a security_context given set new path 
Ondřej Vašík 4afb5b
             components to that context, too */
Ondřej Vašík 4afb5b
          if ( setfscreatecon(optarg) < 0 ) {