All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel J Walsh <dwalsh@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>, SE Linux <selinux@tycho.nsa.gov>
Subject: [Fwd: restorecon single fs patch]
Date: Mon, 02 Apr 2007 14:59:04 -0400	[thread overview]
Message-ID: <46115278.4020401@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

Patch to tell restorecon to only do one file system.

-------- Original Message --------
Subject: 	restorecon single fs patch
Date: 	Mon, 02 Apr 2007 14:54:36 -0400
From: 	Jeremy Katz <katzj@redhat.com>
To: 	dwalsh@redhat.com



Attached.  And from a quick test, works quite nicely

Jeremy



[-- Attachment #2: policycoreutils-restorecon-onefsys.patch --]
[-- Type: text/x-patch, Size: 1617 bytes --]

--- policycoreutils-2.0.7/restorecon/restorecon.c.onefs	2007-04-02 14:35:37.000000000 -0400
+++ policycoreutils-2.0.7/restorecon/restorecon.c	2007-04-02 14:48:05.000000000 -0400
@@ -16,6 +16,7 @@
  * -v	Show changes in file labels.  
  * -o	filename save list of files with incorrect context
  * -F	Force reset of context to match file_context for customizable files
+ * -l   Limit directory tree walk to a single filesystem
  *
  * pathname...	The file(s) to label 
  *
@@ -50,6 +51,7 @@
 static int recurse = 0;
 static int file_exist = 1;
 static int force = 0;
+static int onefs = 0;
 #define STAT_BLOCK_SIZE 1
 static int pipe_fds[2] = { -1, -1 };
 static unsigned long long count = 0;
@@ -326,13 +328,15 @@
 			rc = fork();
 		if (rc == 0) {
 			close(pipe_fds[0]);
-			nftw(buf, pre_stat, 1024, FTW_PHYS);
+			nftw(buf, pre_stat, 1024, 
+                             FTW_PHYS | (onefs ? FTW_MOUNT : 0));
 			exit(1);
 		}
 		if (rc > 0)
 			close(pipe_fds[1]);
 		if (rc == -1 || rc > 0) {
-			if (nftw(buf, apply_spec, 1024, FTW_PHYS)) {
+			if (nftw(buf, apply_spec, 1024, 
+                                 FTW_PHYS | (onefs ? FTW_MOUNT : 0))) {
 				if (!file_exist && errno == ENOENT)
 					return;
 				fprintf(stderr,
@@ -367,11 +371,14 @@
 
 	set_matchpathcon_flags(MATCHPATHCON_NOTRANS);
 
-	while ((opt = getopt(argc, argv, "ipFrRnvf:o:e:")) > 0) {
+	while ((opt = getopt(argc, argv, "ipFrRnvfl:o:e:")) > 0) {
 		switch (opt) {
 		case 'n':
 			change = 0;
 			break;
+                case 'l':
+                    onefs = 1;
+                    break;
 		case 'i':
 			file_exist = 0;
 			break;


             reply	other threads:[~2007-04-02 18:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-02 18:59 Daniel J Walsh [this message]
2007-04-02 19:15 ` [Fwd: restorecon single fs patch] Stephen Smalley
2007-04-24 20:33   ` Stephen Smalley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46115278.4020401@redhat.com \
    --to=dwalsh@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.