public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] schedutils: don't apply -a without -p
@ 2013-03-25  9:33 Daniel Stodden
  2013-03-26 11:39 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Stodden @ 2013-03-25  9:33 UTC (permalink / raw)
  To: util-linux; +Cc: Daniel Stodden

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] schedutils: don't apply -a without -p
  2013-03-25  9:33 [PATCH] schedutils: don't apply -a without -p Daniel Stodden
@ 2013-03-26 11:39 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2013-03-26 11:39 UTC (permalink / raw)
  To: Daniel Stodden; +Cc: util-linux, Daniel Stodden

On Mon, Mar 25, 2013 at 02:33:59AM -0700, Daniel Stodden wrote:
>  schedutils/taskset.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

 Good catch! Applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-26 11:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25  9:33 [PATCH] schedutils: don't apply -a without -p Daniel Stodden
2013-03-26 11:39 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox