diff src/fileio.c @ 1583:ebe059f69b9e v7.1.296

updated for version 7.1-296
author vimboss
date Wed, 07 May 2008 17:09:24 +0000
parents 2c4ca49319a6
children 80b9076e9e17
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3651,6 +3651,9 @@ buf_write(buf, fname, sfname, start, end
 						)
 			    mch_setperm(backup,
 					  (perm & 0707) | ((perm & 07) << 3));
+# ifdef HAVE_SELINUX
+			mch_copy_sec(fname, backup);
+# endif
 #endif
 
 			/*
@@ -3687,6 +3690,9 @@ buf_write(buf, fname, sfname, start, end
 #ifdef HAVE_ACL
 			mch_set_acl(backup, acl);
 #endif
+#ifdef HAVE_SELINUX
+			mch_copy_sec(fname, backup);
+#endif
 			break;
 		    }
 		}
@@ -4309,6 +4315,12 @@ restore_backup:
     }
 #endif
 
+#ifdef HAVE_SELINUX
+    /* Probably need to set the security context. */
+    if (!backup_copy)
+	mch_copy_sec(backup, wfname);
+#endif
+
 #ifdef UNIX
     /* When creating a new file, set its owner/group to that of the original
      * file.  Get the new device and inode number. */