Get page size should never fail (in the works case it fails later with wrong alignment).
[platform/upstream/cryptsetup.git] / lib / utils.c
index 2231522..eef7891 100644 (file)
@@ -30,7 +30,8 @@
 
 unsigned crypt_getpagesize(void)
 {
-       return (unsigned)sysconf(_SC_PAGESIZE);
+       long r = sysconf(_SC_PAGESIZE);
+       return r < 0 ? DEFAULT_MEM_ALIGNMENT : r;
 }
 
 static int get_alignment(int fd)