| 141 |
|
new_siz = sbuf.st_size; |
| 142 |
|
} |
| 143 |
|
if (new_siz > osiz) { // need to extend & remap |
| 144 |
< |
int fd = open(chName, mode&RDSread ? O_RDWR : O_WRONLY); |
| 144 |
> |
int fd = open(chName, O_RDWR); |
| 145 |
|
if (fd < 0) { |
| 146 |
|
sprintf(errmsg, "cannot reopen '%s'", chName); |
| 147 |
|
error(SYSTEM, errmsg); |
| 165 |
|
return osiz = 0; |
| 166 |
|
} |
| 167 |
|
} else if (truncate(chName, new_siz) < 0) { |
| 168 |
< |
sprintf(errmsg, "cannot truncate '%s'", chName); |
| 168 |
> |
sprintf(errmsg, "cannot resize '%s'", chName); |
| 169 |
|
return 0; |
| 170 |
|
} |
| 171 |
|
return osiz = new_siz; |