]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
schedutils: don't apply -a without -p
authorDaniel Stodden <daniel.stodden@googlemail.com>
Mon, 25 Mar 2013 09:33:59 +0000 (02:33 -0700)
committerKarel Zak <kzak@redhat.com>
Tue, 26 Mar 2013 11:37:55 +0000 (12:37 +0100)
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

index aba0b6f9ee02b0bf5069feaa8eab031fd4691944..c2b9ab6f679a46c40c3e37becb5c3831ff9ba61e 100644 (file)
@@ -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);