Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Throw an exception if return value shows an error.
[simgrid.git] / src / xbt / mmalloc / mmap-sup.c
index ad2692c..28f89bc 100644 (file)
@@ -109,9 +109,11 @@ void *__mmalloc_mmap_morecore(struct mdesc *mdp, int size)
       foffset = (char *) mdp->top - (char *) mdp->base;
 
       if (mdp->fd > 0) {
-        /* FIXME:  Test results of lseek() and write() */
+        /* FIXME:  Test results of lseek() */
         lseek(mdp->fd, foffset + mapbytes - 1, SEEK_SET);
         test = write(mdp->fd, &buf, 1);
+        if (test == -1)
+          THROWF(system_error, 0, "write to mmap'ed fd failed! error: %s", strerror(errno));
       }
 
       /* Let's call mmap. Note that it is possible that mdp->top