Skip to contentSkip to conversation

kill_something_info: really ignore -EPERM

PATCH In review Oleg Nesterov 1 participant 1 message Dec 16, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 kill_something_info: really ignore -EPERM

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?

kernel/signal.c renamed from kernel/signal.c~2_perm +1 -5
@@ -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)