Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the amount of implicit include directories
[simgrid.git] / src / surf / storage_n11.cpp
index 7d73325..42fef37 100644 (file)
@@ -433,7 +433,11 @@ StorageAction *StorageN11::close(surf_file_t fd)
 StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size)
 {
   if(fd->current_position + size > fd->size){
-    size = fd->size - fd->current_position;
+    if (fd->current_position > fd->size){
+      size = 0;
+    } else {
+      size = fd->size - fd->current_position;
+    }
     fd->current_position = fd->size;
   }
   else
@@ -498,7 +502,7 @@ int StorageN11Action::unref()
 {
   m_refcount--;
   if (!m_refcount) {
-       if (actionHook::is_linked())
+       if (action_hook.is_linked())
          p_stateSet->erase(p_stateSet->iterator_to(*this));
     if (getVariable())
       lmm_variable_free(getModel()->getMaxminSystem(), getVariable());