Return an error code when a pipe is already present in a slot

This commit is contained in:
2025-09-18 00:54:53 +02:00
parent b0e543177b
commit b3894f1600

View File

@ -49,6 +49,13 @@ int32_t SYSCALL5(sys_ipcpipe, pid1, pipenum1, cmd1, buffer1, len1) {
}
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;
spinlock_release(&proc->pipes_spinlock);