- sscanf(dirent->d_name, "%u", &read_pid);
-
- (*pid_list)[*pid_list_size - 1] = read_pid;
- /* FIXME: Here we previously called pid_is_online, which
- * always returned 1, now I replaced it with just 1.
- * We need to figure out an intelligent way of solving
- * this, maybe connect-disconnect.
- */
- if (1) {
- (*pid_list_size)++;
- *pid_list = realloc(*pid_list,
- *pid_list_size * sizeof(pid_t));
+ if (ustcomm_is_socket_live(dirent->d_name, &read_pid)) {
+
+ (*pid_list)[(*pid_list_index)++] = (long) read_pid;
+
+ if (*pid_list_index == *pid_list_size) {
+ if (realloc_pid_list(pid_list, pid_list_size)) {
+ return -1;
+ }
+ }