73 |
|
mp->len = (size_t)(flen - skip); |
74 |
|
#ifdef MAP_FILE |
75 |
|
if (mp->len > 1L<<20) { /* map file if > 1 MByte */ |
76 |
< |
mp->base = mmap(NULL, mp->len, PROT_READ|PROT_WRITE, |
77 |
< |
MAP_PRIVATE, fd, skip); |
76 |
> |
mp->base = mmap(NULL, mp->len, PROT_READ, MAP_PRIVATE, fd, skip); |
77 |
|
if (mp->base != MAP_FAILED) { |
78 |
|
mp->mapped = 1; |
79 |
|
return(1); /* mmap() success */ |
279 |
|
if (ni_columns <= 0) |
280 |
|
ni_columns = count_columns(rp); |
281 |
|
nrecords = rp->nrecs; |
282 |
< |
} else if ((ni_rows > 0) & (ni_columns > 0)) |
282 |
> |
} else if ((ni_rows > 0) & (ni_columns > 0)) { |
283 |
|
nrecords = ni_rows*ni_columns; |
284 |
< |
else |
284 |
> |
if (nrecords > mp->len / -record_width) { |
285 |
> |
fprintf(stderr, |
286 |
> |
"Input too small for specified size and type\n"); |
287 |
> |
return(0); |
288 |
> |
} |
289 |
> |
} else |
290 |
|
nrecords = mp->len / -record_width; |
291 |
|
/* check sizes */ |
292 |
|
if (ni_rows <= 0) |