Pipeline works with invalid free(TM)
This commit is contained in:
parent
dc9005218c
commit
933d68c2da
6 changed files with 126 additions and 106 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/01 06:59:44 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/08/01 07:03:32 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/08/05 17:01:40 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ t_fd *dup_fd(t_fd *fd)
|
|||
return (NULL);
|
||||
tmp = dup(fd->fd);
|
||||
if (tmp == -1)
|
||||
return (NULL);
|
||||
return (printf("There was an error while duping the fd %d `%s`\n", fd->fd, fd->name), NULL);
|
||||
slot->ty = SLOT_FD;
|
||||
slot->slot.fd.fd = tmp;
|
||||
slot->slot.fd.perms = fd->perms;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/04 17:59:48 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/08/01 06:56:14 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/08/05 17:08:14 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ t_error create_pipe(t_pipe *out)
|
|||
return (ERROR);
|
||||
}
|
||||
read->slot.fd.fd = fd[0];
|
||||
write->slot.fd.fd = fd[0];
|
||||
write->slot.fd.fd = fd[1];
|
||||
read->slot.fd.type = FD_PIPE;
|
||||
write->slot.fd.type = FD_PIPE;
|
||||
read->slot.fd.perms = FD_READ;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/03 16:22:41 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/08/03 16:34:46 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/08/05 15:46:09 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
#include "me/string/string.h"
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_str.h"
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -29,6 +30,8 @@ t_error spawn_process_exec(t_spawn_info info, t_process *process)
|
|||
{
|
||||
if (info.forked_free)
|
||||
info.forked_free(info.forked_free_args);
|
||||
signal(SIGINT, SIG_DFL);
|
||||
signal(SIGQUIT, SIG_DFL);
|
||||
dup2(info.stdin.fd.fd->fd, 0);
|
||||
dup2(info.stdout.fd.fd->fd, 1);
|
||||
dup2(info.stderr.fd.fd->fd, 2);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue