]> git.ozlabs.org Git - ccan/commitdiff
talloc: avoid a comparison mismatch & at the same time switch to non-legacy sysconf()
authorCody P Schafer <dev@codyps.com>
Sun, 16 Aug 2015 22:58:32 +0000 (18:58 -0400)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 17 Aug 2015 02:31:49 +0000 (12:01 +0930)
Without this, gcc warns about a sign mismatch in the comparison.

Signed-off-by: Cody P Schafer <dev@codyps.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/talloc/talloc.c

index 0c6bcda955165e5cb088ec9dadd9da5863c95676..3ada60fca562566aa2207f8ed73c8eae34f24652 100644 (file)
@@ -810,7 +810,7 @@ void *_talloc(const void *context, size_t size)
 
 static int talloc_destroy_pointer(void ***pptr)
 {
-       if ((uintptr_t)**pptr < getpagesize())
+       if ((uintptr_t)**pptr < (uintptr_t)sysconf(_SC_PAGESIZE))
                TALLOC_ABORT("Double free or invalid talloc_set?");
        /* Invalidate pointer so it can't be used again. */
        **pptr = (void *)1;