From: Thomas Liu <tliu@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: selinux@tycho.nsa.gov
Subject: Re: [PATCH] setfiles converted to fts
Date: Wed, 01 Jul 2009 10:41:23 -0400 [thread overview]
Message-ID: <1246459283.4023.1.camel@Ares> (raw)
In-Reply-To: <1246458707.13464.171.camel@moss-pluto.epoch.ncsc.mil>
Thanks for the feedback! I will look into all of the suggestions and
then send another patch with more information.
-Thomas Liu
On Wed, 2009-07-01 at 10:31 -0400, Stephen Smalley wrote:
> On Tue, 2009-06-30 at 15:32 -0400, Thomas Liu wrote:
> > This patch converted setfiles/restorecon to using fts instead of nftw.
> > It also removed forking, pipes and pre_stat because Dan Walsh and I
> > could not figure out what it was for.
>
> Also, please inline your patch as per:
> http://lxr.linux.no/linux/Documentation/SubmittingPatches
> so that it will be included in the reply for commenting on it.
>
> A couple of comments below.
>
> -static int restore(const char *file)
> +static int restore(const char *file, struct stat *sb)
> {
> char *my_file = strdupa(file);
> - struct stat my_sb;
> + struct stat my_sb = *sb;
> int ret;
> char *context, *newcon;
> int user_only_changed = 0;
>
> If we truly don't need a private stat struct anymore (i.e. fts will pass
> us the true stat structure even for symlinks), then just replace all
> occurrences of my_sb with sb and remove my_sb altogether.
>
> @@ -549,42 +542,38 @@ static int restore(const char *file)
> if (ret) {
> fprintf(stderr, "%s set context %s->%s failed:'%s'\n",
> progname, my_file, newcon, strerror(errno));
> - goto out;
> + goto skip;
> }
> + skip:
> + freecon(newcon);
> + return SKIP;
>
> This looks wrong - it means that you return SKIP in the success path as
> well. I think you wanted skip: to follow the return 0 of the out: path?
>
> out:
> freecon(newcon);
> return 0;
> err:
> freecon(newcon);
> - return -1;
> + return ERR;
> }
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
prev parent reply other threads:[~2009-07-01 14:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 19:32 [PATCH] setfiles converted to fts Thomas Liu
2009-06-30 19:47 ` Stephen Smalley
2009-06-30 20:57 ` Daniel J Walsh
2009-07-01 13:41 ` Stephen Smalley
2009-07-01 13:52 ` Stephen Smalley
2009-07-01 14:31 ` Stephen Smalley
2009-07-01 14:41 ` Thomas Liu [this message]
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=1246459283.4023.1.camel@Ares \
--to=tliu@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.