If strtol() returns an errno, make sure not to print the error message
twice after the refactoring.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
continue;
}
if (errno != 0) {
- fprintf(stderr, "error parsing vmid for %d: %s\n", pid, strerror(errno));
vmid = 0;
}
- goto ret;
+ break;
}
if (errno) {
fprintf(stderr, "error parsing vmid for %d: %s\n", pid, strerror(errno));
- } else {
+ } else if (!vmid) {
fprintf(stderr, "error parsing vmid for %d: no matching qemu.slice cgroup entry\n", pid);
}
-ret:
free(buf);
fclose(fp);
return vmid;