mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@osdl.org>, Michael Kerrisk <mtk-lkml@gmx.net>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] kill_something_info: really ignore -EPERM
Date: Sat, 16 Dec 2006 23:06:02 +0300	[thread overview]
Message-ID: <20061216200602.GA5538@tv-sign.ru> (raw)

kill(-1, sig) returns 0 if it has found some processes but there
is no one for which we have permission to send the signal.

Doesn't it make more sense to return -ESRCH in this case?

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- eric-mm1/kernel/signal.c~2_perm	2006-12-16 22:17:52.000000000 +0300
+++ eric-mm1/kernel/signal.c	2006-12-16 22:22:48.000000000 +0300
@@ -1326,20 +1326,16 @@ static int kill_something_info(int sig, 
 		ret = kill_pid_info(sig, info, find_pid(pid));
 	} else if (pid == -1) {
 		struct task_struct *p;
-		int found = 0;
 
-		ret = 0;
+		ret = -ESRCH;
 		read_lock(&tasklist_lock);
 		for_each_process(p)
 			if (!is_init(p) && p != current->group_leader) {
 				int err = group_send_sig_info(sig, info, p);
 				if (err != -EPERM)
 					ret = err;
-				found = 1;
 			}
 		read_unlock(&tasklist_lock);
-		if (!found)
-			ret = -ESRCH;
 	} else {
 		struct pid *grp = task_pgrp(current);
 		if (pid != 0)


                 reply	other threads:[~2006-12-16 20:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061216200602.GA5538@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk-lkml@gmx.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®