summaryrefslogtreecommitdiffstats
path: root/include/c.h
diff options
context:
space:
mode:
authorKarel Zak2014-12-04 10:27:39 +0100
committerKarel Zak2014-12-04 10:27:39 +0100
commit19ff8ff7c448e4e88e602dde0af4230bff5b4daa (patch)
tree489b3709b6c98b9970dc5fc97cb68079f29db6cc /include/c.h
parentlsblk: add SUBSYSTEMS column (diff)
downloadkernel-qcow2-util-linux-19ff8ff7c448e4e88e602dde0af4230bff5b4daa.tar.gz
kernel-qcow2-util-linux-19ff8ff7c448e4e88e602dde0af4230bff5b4daa.tar.xz
kernel-qcow2-util-linux-19ff8ff7c448e4e88e602dde0af4230bff5b4daa.zip
libfdisk: fix cfdisk freespace analyze
The problem is how fdisk_partition_cmp_start() compare numbers, the function returns result from "a->start - b->start", unfortunately the numbers are uint64, but function returns "int". Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1170191 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/c.h')
-rw-r--r--include/c.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/c.h b/include/c.h
index 0f6e5b29b..142583956 100644
--- a/include/c.h
+++ b/include/c.h
@@ -107,6 +107,14 @@
_max1 > _max2 ? _max1 : _max2; })
#endif
+#ifndef cmp_numbers
+# define cmp_numbers(x, y) __extension__ ({ \
+ __typeof__(x) _a = (x); \
+ __typeof__(y) _b = (y); \
+ (void) (&_a == &_b); \
+ a == b ? 0 : a > b ? 1 : -1; })
+#endif
+
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif