psmisc/psmisc-22.21-boo908063.patch

27 lines
726 B
Diff
Raw Normal View History

---
src/pstree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- src/pstree.c
+++ src/pstree.c 2015-03-24 11:49:59.221518469 +0000
@@ -826,6 +826,7 @@ static char* get_threadname(const pid_t
if (! (threadname = malloc(COMM_LEN + 2 + 1))) {
exit(2);
}
+ *threadname = '\0';
if (snprintf(path, PATH_MAX, "%s/%d/task/%d/stat", PROC_BASE, pid, tid) < 0)
perror("get_threadname: asprintf");
if ( (file = fopen(path, "r")) != NULL) {
@@ -839,10 +840,10 @@ static char* get_threadname(const pid_t
return threadname;
}
}
+ fclose(file);
}
/* Fall back to old method */
sprintf(threadname, "{%.*s}", COMM_LEN, comm);
- fclose(file);
return threadname;
}