← Commit list

9c291f2cc

Denys Vlasenko
Denys Vlasenko
2021-06-20
SUCCESS Duration: 155s

Subject

taskset: fix for PID longer than 12 chars

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

util-linux/taskset.c+3 -2
@@ -346,12 +346,13 @@ int taskset_main(int argc UNUSED_PARAM, char **argv)
aff = NULL;
if (opts & OPT_a) {
- char dn[sizeof("/proc/%s/task") + 3 * sizeof(int)];
+ char *dn;
DIR *dir;
struct dirent *ent;
- sprintf(dn, "/proc/%s/task", pid_str);
+ dn = xasprintf("/proc/%s/task", pid_str);
dir = opendir(dn);
+ IF_FEATURE_CLEAN_UP(free(dn);)
if (!dir) {
goto no_threads;
}