X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fprocesses.c;fp=src%2Fprocesses.c;h=4761f60ecc26df9b2d774acec20e1a2d89cca953;hp=f83913afb9ca77cd97d3063127768a2a0c2e0da1;hb=5ebc182261321f0781f38d8645bfc7c74353434c;hpb=d56aca9a8efcc1e40ce0c7f4b1123aaa8d3115ab diff --git a/src/processes.c b/src/processes.c index f83913af..4761f60e 100644 --- a/src/processes.c +++ b/src/processes.c @@ -1316,11 +1316,10 @@ static int ps_read_process(long pid, process_entry_t *ps, char *state) { snprintf(filename, sizeof(filename), "/proc/%li/stat", pid); - status = read_file_contents(filename, buffer, sizeof(buffer) - 1); + status = read_text_file_contents(filename, buffer, sizeof(buffer)); if (status <= 0) return -1; buffer_len = (size_t)status; - buffer[buffer_len] = 0; /* The name of the process is enclosed in parens. Since the name can * contain parens itself, spaces, numbers and pretty much everything @@ -1569,7 +1568,7 @@ static char *ps_get_cmdline(long pid, snprintf(path, sizeof(path), "/proc/%li/psinfo", pid); - status = read_file_contents(path, (void *)&info, sizeof(info)); + status = read_file_contents(path, &info, sizeof(info)); if ((status < 0) || (((size_t)status) != sizeof(info))) { ERROR("processes plugin: Unexpected return value " "while reading \"%s\": "