This commit is contained in:
Baptiste Wicht 2014-02-13 18:49:45 +01:00
parent 04468b9f0b
commit 276b83ee1a

View File

@ -815,11 +815,15 @@ size_t scheduler::register_new_handle(const std::string& path){
} }
void scheduler::release_handle(size_t fd){ void scheduler::release_handle(size_t fd){
pcb[current_pid].handles[fd] = nullptr; pcb[current_pid].handles[fd].clear();
} }
bool scheduler::has_handle(size_t fd){ bool scheduler::has_handle(size_t fd){
return pcb[current_pid].handles.size() - 1 <= fd; if(fd < pcb[current_pid].handles.size()){
return pcb[current_pid].handles[fd].empty();
}
return false;
} }
const std::string& scheduler::get_handle(size_t fd){ const std::string& scheduler::get_handle(size_t fd){