diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-08-15 20:41:18 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-08-15 20:41:18 +0200 |
commit | 319e20b56b281c9ce552f918b1a1d4c5577d38d6 (patch) | |
tree | 11f3de786120e0e4953380c617d698ca95e437a9 /util-linux | |
parent | ac2d4d88ce54d418b579a50ae18434fbf5ffa58a (diff) |
taskset: disallow "taskset -p 0"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/taskset.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util-linux/taskset.c b/util-linux/taskset.c index afe2f04d2..d2ef9b98f 100644 --- a/util-linux/taskset.c +++ b/util-linux/taskset.c @@ -218,7 +218,7 @@ static int process_pid_str(const char *pid_str, unsigned opts, char *aff) ul *mask; unsigned mask_size_in_bytes; const char *current_new; - pid_t pid = xatoi_positive(pid_str); + pid_t pid = !pid_str ? 0 : xatou_range(pid_str, 1, INT_MAX); /* disallow "0": "taskset -p 0" should fail */ mask_size_in_bytes = SZOF_UL; current_new = "current"; @@ -343,7 +343,7 @@ int taskset_main(int argc UNUSED_PARAM, char **argv) /* <aff> <cmd...> */ if (!*argv) bb_show_usage(); - process_pid_str("0", opts, aff); + process_pid_str(NULL, opts, aff); BB_EXECVP_or_die(argv); } |