All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Boot <bootc@bootc.net>
To: netfilter-devel@vger.kernel.org
Cc: Eric Leblond <eric@regit.org>
Subject: Re: [PATCH 1/2] ulogd: Perform nice() before giving up root
Date: Fri, 17 May 2013 08:34:13 +0100	[thread overview]
Message-ID: <5195DD75.7040609@bootc.net> (raw)
In-Reply-To: <1368291713-40132-2-git-send-email-bootc@bootc.net>

On 11/05/13 18:01, Chris Boot wrote:
> The daemon code currently tries to nice(-1) just after having given up root
> privileges, which fails. This patch moves the nice(-1) call to just before
> the code that gives up the required privileges.
>
> Signed-off-by: Chris Boot <bootc@bootc.net>
> ---
>  src/ulogd.c |   14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/src/ulogd.c b/src/ulogd.c
> index b28d0f8..8a144e3 100644
> --- a/src/ulogd.c
> +++ b/src/ulogd.c
> @@ -1235,6 +1235,13 @@ int main(int argc, char* argv[])
>  		warn_and_exit(daemonize);
>  	}
>  
> +	errno = 0;
> +	if (nice(-1) == -1) {
> +		if (errno != 0)
> +			ulogd_log(ULOGD_ERROR, "Could not nice process: %s\n",
> +				  strerror(errno));
> +	}
> +
>  	if (change_uid) {
>  		ulogd_log(ULOGD_NOTICE, "Changing UID / GID\n");
>  		if (setgid(gid)) {
> @@ -1261,13 +1268,6 @@ int main(int argc, char* argv[])
>  		}
>  	}
>  
> -	errno = 0;
> -	if (nice(-1) == -1) {
> -		if (errno != 0)
> -			ulogd_log(ULOGD_ERROR, "Could not nice process: %s\n",
> -				  strerror(errno));
> -	}
> -
>  
>  	if (daemonize){
>  		if (fork()) {

Hi all,

I have had no comments about this patch since I submitted it; is it
likely to get pulled into ulogd?

Cheers,
Chris

-- 
Chris Boot
bootc@bootc.net


  reply	other threads:[~2013-05-17  7:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-11 17:01 [PATCH 0/2] Introductions, some tweaks to ulogd Chris Boot
2013-05-11 17:01 ` [PATCH 1/2] ulogd: Perform nice() before giving up root Chris Boot
2013-05-17  7:34   ` Chris Boot [this message]
2013-05-17  8:28     ` Eric Leblond
2013-05-11 17:01 ` [PATCH 2/2] ulogd: Implement PID file writing Chris Boot
2013-05-11 19:21   ` Pablo Neira Ayuso
2013-05-11 20:27     ` Chris Boot
2013-05-12  0:48       ` Pablo Neira Ayuso
2013-05-12  8:11         ` Chris Boot
2013-05-12  9:34           ` Pablo Neira Ayuso
2013-05-12  9:38             ` Chris Boot
2013-05-12 10:50               ` Pablo Neira Ayuso
2013-05-12 19:34                 ` Eric Leblond
2013-05-12  9:47             ` Eric Leblond
2013-05-12 10:08               ` Chris Boot
2013-05-12 10:49               ` Pablo Neira Ayuso
2013-05-12  9:53   ` Eric Leblond
2013-05-12 10:59     ` Chris Boot
2013-05-12 12:47       ` [PATCH v2] " Chris Boot
2013-05-17  7:33         ` Chris Boot
2013-05-19 19:19           ` Eric Leblond
2013-05-19 19:22             ` [Ulogd PATCH] Improve pid file handling Eric Leblond
2013-05-22  9:22               ` Chris Boot
  -- strict thread matches above, loose matches on Subject: below --
2013-05-17 12:01 [PATCH 1/2] ulogd: Perform nice() before giving up root Eric Leblond

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=5195DD75.7040609@bootc.net \
    --to=bootc@bootc.net \
    --cc=eric@regit.org \
    --cc=netfilter-devel@vger.kernel.org \
    /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.