Skip to content
Snippets Groups Projects
Commit cb48cc47 authored by Morris Jette's avatar Morris Jette
Browse files

Merge branch 'slurm-15.08' into slurm-16.05

parents a1b0a459 fa073e12
No related branches found
No related tags found
No related merge requests found
......@@ -262,6 +262,7 @@ documents those changes that are of interest to users and administrators.
-- Print correct return code on failure to update node features through sview.
-- Documentation - cleanup typos.
-- Add logic so that slurmstepd can be launched under valgrind.
-- Increase buffer size to read /proc/*/stat files.
* Changes in Slurm 15.08.12
===========================
......
......@@ -149,7 +149,8 @@ static xppid_t **_build_hashtbl(void)
{
DIR *dir;
struct dirent *de;
char path[PATH_MAX], *endptr, *num, rbuf[1024];
char path[PATH_MAX], *endptr, *num, *rbuf;
ssize_t buf_used;
char myname[1024], cmd[1024];
char state;
int fd;
......@@ -167,6 +168,7 @@ static xppid_t **_build_hashtbl(void)
hashtbl = (xppid_t **)xmalloc(HASH_LEN * sizeof(xppid_t *));
slurm_seterrno(0);
rbuf = xmalloc(4096);
while ((de = readdir(dir)) != NULL) {
num = de->d_name;
if ((num[0] < '0') || (num[0] > '9'))
......@@ -183,7 +185,8 @@ static xppid_t **_build_hashtbl(void)
if ((fd = open(path, O_RDONLY)) < 0) {
continue;
}
if (read(fd, rbuf, 1024) <= 0) {
buf_used = read(fd, rbuf, 4096);
if ((buf_used <= 0) || (buf_used >= 4096)) {
close(fd);
continue;
}
......@@ -202,6 +205,7 @@ static xppid_t **_build_hashtbl(void)
_push_to_hashtbl((pid_t)ppid, (pid_t)pid,
xstrcmp(myname, cmd), cmd, hashtbl);
}
xfree(rbuf);
closedir(dir);
return hashtbl;
}
......
......@@ -196,7 +196,8 @@ proctrack_p_get_pids(uint64_t cont_id, pid_t **pids, int *npids)
{
DIR *dir;
struct dirent *de;
char path[PATH_MAX], *endptr, *num, rbuf[1024];
char path[PATH_MAX], *endptr, *num, *rbuf;
ssize_t buf_used;
char cmd[1024];
char state;
int fd, rc = SLURM_SUCCESS;
......@@ -209,6 +210,7 @@ proctrack_p_get_pids(uint64_t cont_id, pid_t **pids, int *npids)
rc = SLURM_ERROR;
goto fini;
}
rbuf = xmalloc(4096);
while ((de = readdir(dir)) != NULL) {
num = de->d_name;
if ((num[0] < '0') || (num[0] > '9'))
......@@ -223,7 +225,8 @@ proctrack_p_get_pids(uint64_t cont_id, pid_t **pids, int *npids)
if ((fd = open(path, O_RDONLY)) < 0) {
continue;
}
if (read(fd, rbuf, 1024) <= 0) {
buf_used = read(fd, rbuf, 4096);
if ((buf_used <= 0) || (buf_used >= 4096)) {
close(fd);
continue;
}
......@@ -243,6 +246,7 @@ proctrack_p_get_pids(uint64_t cont_id, pid_t **pids, int *npids)
xrealloc(pid_array, sizeof(pid_t) * (pid_count + 1));
pid_array[pid_count++] = pid;
}
xfree(rbuf);
closedir(dir);
fini: *pids = pid_array;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment