git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@64022 15284696-431f-4ddb-bdfa-cd5b030d7da7
@@ -63,7 +63,9 @@ int Segment_init(SEGMENT *SEG, int fd, int nseg)
SEG->nseg = nseg;
if (lseek(fd, 0L, SEEK_SET) < 0) {
- G_warning("Segment_init: %s", strerror(errno));
+ int err = errno;
+
+ G_warning("Segment_init: %s", strerror(err));
return -1;
}
@@ -81,6 +81,7 @@ Segment_open(SEGMENT *SEG, char *fname, off_t nrows, off_t ncols,
/* re-open for read and write */
close(SEG->fd);
+ SEG->fd = -1;
if (-1 == (SEG->fd = open(SEG->fname, 2))) {
unlink(SEG->fname);
G_warning(_("Unable to re-open segment file"));
@@ -37,8 +37,14 @@
int seg_pageout(SEGMENT * SEG, int i)
{
SEG->seek(SEG, SEG->scb[i].n, 0);
+ errno = 0;
if (write(SEG->fd, SEG->scb[i].buf, SEG->size) != SEG->size) {
- G_warning("Segment pageout: %s", strerror(errno));
+ if (err)
+ G_warning("Segment pageout: %s", strerror(err));
+ else
+ G_warning("Segment pageout: insufficient disk space?");
SEG->scb[i].dirty = 0;