X-Git-Url: http://git.liburcu.org/?p=ust.git;a=blobdiff_plain;f=libustctl%2Flibustctl.c;h=4e6c495c6b744b5e8cb853a7309fbc0c6d908a44;hp=8b0dfc164c56bb9571a1202ed8f84d40ada3999b;hb=0f79e1ef1d4f31a91476f5a84e367f2c49ce4723;hpb=317117239797a3609c1ec817a59bb3e70c9c1cba diff --git a/libustctl/libustctl.c b/libustctl/libustctl.c index 8b0dfc1..4e6c495 100644 --- a/libustctl/libustctl.c +++ b/libustctl/libustctl.c @@ -110,7 +110,7 @@ static int get_pids_in_dir(DIR *dir, pid_t **pid_list, unsigned int *pid_list_size) { struct dirent *dirent; - long read_pid; + pid_t read_pid; while ((dirent = readdir(dir))) { if (!strcmp(dirent->d_name, ".") || @@ -121,21 +121,9 @@ static int get_pids_in_dir(DIR *dir, pid_t **pid_list, continue; } - errno = 0; - read_pid = strtol(dirent->d_name, NULL, 10); - if (errno) { - continue; - } - - /* - * 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) { + if (ustcomm_is_socket_live(dirent->d_name, &read_pid)) { - (*pid_list)[(*pid_list_index)++] = 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)) {