Skip to contentSkip to conversation

schedutils: don't apply -a without -p

PATCH In review Daniel Stodden 2 participants 2 messages Mar 25, 2013 – Mar 26, 2013 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 schedutils: don't apply -a without -p

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.

---
 schedutils/taskset.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
schedutils/taskset.c +1 -1
index aba0b6f..c2b9ab6 100644
@@ -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);
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw
Quoted 2 lines · Daniel Stodden
 schedutils/taskset.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Good catch! Applied, thanks.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com