
On Thu, Oct 06, 2016 at 05:18:11PM +0200, Pavel Hrdina wrote:
On Thu, Oct 06, 2016 at 04:58:40PM +0200, Michal Privoznik wrote:
Pids are signed, report them as such.
Before: Detected mount/mapping 2:cpuset at /sys/fs/cgroup/cpuset in /machine/qemu-4-fedora.libvirt-qemu/vcpu0 for pid 18446744073709551615
After: Detected mount/mapping 2:cpuset at /sys/fs/cgroup/cpuset in /machine/qemu-4-fedora.libvirt-qemu/vcpu0 for pid -1
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/util/vircgroup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 8b52816..0a06a8a 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -732,11 +732,12 @@ virCgroupDetect(virCgroupPtr group, return -1; }
- VIR_DEBUG("Detected mount/mapping %zu:%s at %s in %s for pid %llu", i, + VIR_DEBUG("Detected mount/mapping %zu:%s at %s in %s for pid %lld", + i, virCgroupControllerTypeToString(i), group->controllers[i].mountPoint, group->controllers[i].placement, - (unsigned long long)pid); + (long long) pid); }
return 0;
Printing -1 instead of long number is better, but there are lot of other places where we print pids as unsigned:
git grep "unsigned long long.*pid"
it would be worth to change them too.
And add a syntax-check rule to detect such casts. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|