X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fprocevent.c;fp=src%2Fprocevent.c;h=e05fa0c8e79bba93a9a3e5c3606a404238cc3ecb;hb=614f026c29b712c3a492b5cc82e48814d1609a99;hp=e4f473bed14666b496c547e3a6e4c1836ef51da1;hpb=6ff769e0d7d6363e2f507118ccb7722457370442;p=collectd.git diff --git a/src/procevent.c b/src/procevent.c index e4f473be..e05fa0c8 100644 --- a/src/procevent.c +++ b/src/procevent.c @@ -103,7 +103,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); // Does /proc//comm contain a process name we are interested in? static processlist_t *process_check(int pid) { - int len, is_match, status; + int len, is_match, status, retval; char file[BUFSIZE]; FILE *fh; char buffer[BUFSIZE]; @@ -122,7 +122,13 @@ static processlist_t *process_check(int pid) { return NULL; } - fscanf(fh, "%[^\n]", buffer); + retval = fscanf(fh, "%[^\n]", buffer); + + if (retval < 0) { + WARNING("procevent process_check: unable to read comm file for pid %d", + pid); + return NULL; + } // // Go through the processlist linked list and look for the process name