[PATCH] schedutils: don't apply -a without -p

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The unsuspecting user might use taskset -a mask command. Behavior then
is to exec with no affinity applied at all. Better handled by ignoring
all_tasks if no pid was given.

Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxx>
---
 schedutils/taskset.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/schedutils/taskset.c b/schedutils/taskset.c
index aba0b6f..c2b9ab6 100644
--- a/schedutils/taskset.c
+++ b/schedutils/taskset.c
@@ -217,7 +217,7 @@ int main(int argc, char **argv)
 		     argv[optind]);
 	}
 
-	if (all_tasks) {
+	if (all_tasks && pid) {
 		struct proc_tasks *tasks = proc_open_tasks(pid);
 		while (!proc_next_tid(tasks, &ts.pid))
 			do_taskset(&ts, new_setsize, new_set);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux