X-Git-Url: http://git.lttng.org/?p=ust.git;a=blobdiff_plain;f=ustctl%2Fscanning_functions.c;h=4aa8c1c93e81cf7c6cd675692129dd84c859c023;hp=0cf809e061a126ac57f6699c21d48756f7d006e1;hb=HEAD;hpb=0c89df6cb75f1d967003137e7fc334af1128a42f diff --git a/ustctl/scanning_functions.c b/ustctl/scanning_functions.c index 0cf809e..4aa8c1c 100644 --- a/ustctl/scanning_functions.c +++ b/ustctl/scanning_functions.c @@ -17,13 +17,14 @@ #define _GNU_SOURCE #include -#include +#include #include "usterr.h" -pid_t parse_pid(const char *pid_string) +int parse_and_connect_pid(const char *pid_string) { pid_t pid; + int sock; errno = 0; pid = strtoull(pid_string, NULL, 10); @@ -32,7 +33,13 @@ pid_t parse_pid(const char *pid_string) exit(EXIT_FAILURE); } - return pid; + sock = ustctl_connect_pid(pid); + if (sock < 0) { + perror("Failed to connect to process"); + exit(EXIT_FAILURE); + } + + return sock; } int scan_ch_marker(const char *channel_marker, char **channel, char **marker)