static int
allocate_space (int fd, off_t offset, off_t len)
{
- static size_t page_size;
+ static long page_size;
/* Obtain system page size. */
if (!page_size)
{
ffi_status rc;
size_t int_size = ffi_type_sint.size;
- int i;
+ unsigned int i;
rc = ffi_prep_cif_core(cif, abi, 1, nfixedargs, ntotalargs, rtype, atypes);
* trampoline table to make sure that the temporary file can be mapped.
*/
count = write(tramp_globals.fd, tramp_globals.text, tramp_globals.map_size);
- if (count == tramp_globals.map_size && tramp_table_alloc ())
+ if (count >=0 && (size_t)count == tramp_globals.map_size && tramp_table_alloc ())
return 1;
close (tramp_globals.fd);
static int
ffi_tramp_init (void)
{
+ long page_size;
+
if (tramp_globals.status == TRAMP_GLOBALS_PASSED)
return 1;
&tramp_globals.map_size);
tramp_globals.ntramp = tramp_globals.map_size / tramp_globals.size;
- if (sysconf (_SC_PAGESIZE) > tramp_globals.map_size)
+ page_size = sysconf (_SC_PAGESIZE);
+ if (page_size >= 0 && (size_t)page_size > tramp_globals.map_size)
return 0;
if (ffi_tramp_init_os ())