char *endptr;
long val = strtol (&line.c_str()[5], &endptr, 10);
if ((errno == ERANGE && val == LONG_MAX)
- || *endptr != '\n' || val < 0 || val != (pid_t) val)
+ || (*endptr != 0 && *endptr != '\n')
+ /* <- getline(3) ambiguous on what ends the string */
+ || val < 0 || val != (pid_t) val)
*pid = 0;
else
*pid = (pid_t) val;
goto reuse;
}
err = this->find_procfile(dwfl, &pid, &elf, &elf_fd);
- if (err != 0) /* TODO check errnos */
+ if (err != 0)
{
if (verbose)
cerr << format("WARNING: find_procfile pid {}: {}\n", (long long) pid, dwfl_errmsg(-1));