X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/67cb7f877ae5baa44daf956a801f9bade02e0335..2d5a938ad21f02f5d44a7d59f5a57d1b66f461e3:/src/surf/workstation_interface.cpp diff --git a/src/surf/workstation_interface.cpp b/src/surf/workstation_interface.cpp index f37bff3ae6..4dd66367dc 100644 --- a/src/surf/workstation_interface.cpp +++ b/src/surf/workstation_interface.cpp @@ -315,22 +315,20 @@ sg_size_t Workstation::fileTell(surf_file_t fd){ return fd->current_position; } -int Workstation::fileSeek(surf_file_t fd, sg_size_t offset, int origin){ +msg_error_t Workstation::fileSeek(surf_file_t fd, sg_size_t offset, int origin){ switch (origin) { case SEEK_SET: - fd->current_position = 0; - return MSG_OK; + fd->current_position = offset; + return MSG_OK; case SEEK_CUR: - if(offset > fd->size) - offset = fd->size; - fd->current_position = offset; - return MSG_OK; + fd->current_position += offset; + return MSG_OK; case SEEK_END: - fd->current_position = fd->size; - return MSG_OK; + fd->current_position = fd->size + offset; + return MSG_OK; default: - return MSG_TASK_CANCELED; + return MSG_TASK_CANCELED; } }