Return an error code when a pipe is already present in a slot
This commit is contained in:
@ -49,6 +49,13 @@ int32_t SYSCALL5(sys_ipcpipe, pid1, pipenum1, cmd1, buffer1, len1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
spinlock_acquire(&proc->pipes_spinlock);
|
spinlock_acquire(&proc->pipes_spinlock);
|
||||||
|
if (proc->pipes[pipenum] != NULL) {
|
||||||
|
spinlock_release(&proc->pipes_spinlock);
|
||||||
|
ipc_pipefree(pipe);
|
||||||
|
dlfree(pipe);
|
||||||
|
ret = E_RESOURCEAVAIL;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
proc->pipes[pipenum] = pipe;
|
proc->pipes[pipenum] = pipe;
|
||||||
spinlock_release(&proc->pipes_spinlock);
|
spinlock_release(&proc->pipes_spinlock);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user